单项选择题

Given the following code:   
 public class Person{    
int arr[] = new int[10]; 
public static void main(String a[]) {    
System.out.println(arr[1]);   
 }    
} 
Which statement is correct?() 

A. When compilation some error will occur.
B. It is correct when compilation but will cause error when running.
C. The output is zero.
D. The output is null.


您可能感兴趣的试卷

你可能感兴趣的试题

1.单项选择题

Given the following code:    
public class Person{ static int arr[] = new int[10]; 
public static void main(String a[]) {    
System.out.println(arr[1];)    
}    
}
 Which statement is correct?()   

A. When compilation some error will occur.
B. It is correct when compilation but will cause error when running.
C. The output is zero.
D. The output is null.

2.多项选择题Which statements about Java code security are true?() 

A. The bytecode verifier loads all classes needed for the execution of a program.
B. Executing code is performed by the runtime interpreter.
C. At runtime the bytecodes are loaded, checked and run in an interpreter.
D. The class loader adds security by separating the namespaces for the classes of the local file system from those imported from network sources.

5.多项选择题Which of the following statements about variables and scope are true?() 

A. Local variables defined inside a method are destroyed when the method is exited.
B. Local variables are also called automatic variables.
C. Variables defined outside a method are created when the object is constructed.
D. A method parameter variable continues to exist for as long as the object is needed in which the method is defined.

7.多项选择题In the Java API documentation which sections are included in a class document?()    

A. The description of the class and its purpose
B. A list of methods in its super class
C. A list of member variable
D. The class hierarchy

8.多项选择题Which of the following statements about declaration are true?()         

A. Declaration of primitive types such as boolean, byte and so on does not allocate memory space for the variable.
B. Declaration of primitive types such as boolean, byte and so on allocates memory space for the variable.
C. Declaration of nonprimitive types such as String, Vector and so on does not allocate memory space for the object.
D. Declaration of nonprimitive types such as String, Vector ans so on allocates memory space for the object.