我有这样的练习:
public class Test2 {
public static void main (String [] args){
int index=1;
getArray()[index=2]++; //why???
}
public static int[] getArray() {
return null;
}
}
在我看来,要调用静态方法getArray,必须编写:
getArray();
...没有索引!
我认为这段代码有一个编译器错误。
你能给我解释一下为什么getArray() [index =2]++;
编译没有错误吗?
https://stackoverflow.com/questions/56778551
复制相似问题