1.public class Example{
2. static int x;
3. static public void main(String[ ]args){
4. x=x+1;
5. System.out.println("Value is"+x);
6. }
7.}
A、代码编译失败,因为main()方法形式不对。
B、代码编译成功,但在运行期第5行抛出一个NullPointerException异常。
C、代码编译成功,打印输出Value is 1。
D、代码编译失败,因为变量x未被初始化。
C