import java.util.ArrayList;
public class Tester {
public static void main(String[] args ) {
ArrayList<Comparable> Aria = new ArrayList<Comparable>();
Aria.add(new Integer(1));
}
}
大家好。这是我的全班测试员。我想将一个整数输入到 Comparable ArrayList 中。但是,我收到一条错误消息:method ArrayList.add(int, Comparable) is not applicable (actual and formal arguments differ in lengths of list) method ArrayList.add(Comparable) is not applicable (actual argument Integer cannot be converted to Comparable by method invocation conversion).
我的朋友在他的电脑上试过这个,它没有错误。感谢您的帮助!