2013年10月1日星期二

The following statement will output what seeking process

public class T2 {

long a[] = new long[10];
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(a[5]);
}
}

------ Solution ------------------------------------- -------

This code will generate an error at compile time , because static methods can not call non-static property values

can be long a [] = new long [10]; replaced by static long a [] = new long [10];


------ For reference only ---------------------------------- -----

没有评论:

发表评论