单选题:For the code below, which statement is right? ( )
For the code below, which statement is right? ( ) @[C](2)
```Java
public class MyClass {
static int myArg = 1;
public static void main(String[] args) {
int myArg;
System.out.println(myArg);
}
}
```
A. Compiles, result is 1
B. Compiles, result is 0
C. Compile error for no initialization for myArg
D. Compile error for local variable myArg has the same name with a static one
A.Compiles, result is 1
B.Compiles, result is 0
C.Compile error for no initialization for myArg
D.Compile error for local variable myArg has the same name with a static one
答案:C
```Java
public class MyClass {
static int myArg = 1;
public static void main(String[] args) {
int myArg;
System.out.println(myArg);
}
}
```
A. Compiles, result is 1
B. Compiles, result is 0
C. Compile error for no initialization for myArg
D. Compile error for local variable myArg has the same name with a static one
A.Compiles, result is 1
B.Compiles, result is 0
C.Compile error for no initialization for myArg
D.Compile error for local variable myArg has the same name with a static one
答案:C