public class T2 {
long a[] = new long[10];
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(a[5]);
}
}
long a[] = new long[10];
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(a[5]);
}
}
此段代码在编译的时候将会报错,因为静态方法中无法调用非静态属性值可将long a[] = new long[10];改为 static long a[] = new long[10];