public class IoTest {
int arr[] = new int[10];
public static void main(String[] args) throws IOException {
System.out.println(arr[1]);
}
}
如上代码编译时将产生错误,因为main为静态方法,不能引用非静态成员。
public class IoTest {
int arr[] = new int[10];
public static void main(String[] args) throws IOException {
System.out.println(arr[1]);
}
}
如上代码编译时将产生错误,因为main为静态方法,不能引用非静态成员。