多项选择题Which two valid declarations of a char?()   

A. Char ch = “a”;
B. Char ch = ‘\’ ‘;
C. Char ch = ‘cafe’;
D. Char ch = “cafe”;
E. Char ch = ‘\ucafe’;
F. Char ch = ‘\u10100’;
G. Char ch = (char) true;


您可能感兴趣的试卷

你可能感兴趣的试题

1.单项选择题

public class foo { 
static String s; 
public static void main (String[]args) { 
system.out.printIn (“s=” + s); 
}
} 
What is the result?()  

A. The code compiles and “s=” is printed.
B. The code compiles and “s=null” is printed.
C. The code does not compile because string s is not initialized.
D. The code does not compile because string s cannot be referenced.
E. The code compiles, but a NullPointerException is thrown when toString is called.

2.多项选择题

public interface Foo{ 
int k = 4; 
}  
Which three are equivalent to line 2?() 

A. Final int k = 4;
B. Public int k = 4;
C. Static int k = 4;
D. Private int k = 4;
E. Abstract int k = 4;
F. Volatile int k = 4;

3.单项选择题

int index = 1; 
String [] test = new String[3]; 
String foo = test[index];    
What is the result?()  

A. Foo has the value “”
B. Foo has the value null
C. An exception is thrown
D. The code will not compile

7.多项选择题Which two statements are true regarding the creation of a default constructor?() 

A. The default constructor initializes method variables.
B. The compiler always creates a default constructor for every class.
C. The default constructor invokes the no-parameter constructor of the superclass.
D. The default constructor initializes the instance variables declared in the class.
E. When a class has only constructors with parameters, the compiler does not create a default constructor.

8.单项选择题

1. public class ArrayTest { 
2. public static void main (String[]args)  { 
3. float f1[], f2[]; 
4. f1 = new float [10]; 
5. f2 = f1; 
6. System.out.printIn (“f2[0]=” + f2[0]); 
7.  } 
8. }  
What is the result?()  

A. It prints f2[0] = 0.0
B. It prints f2[0] = NaN
C. An error at line 5 causes compile to fail.
D. An error at line 6 causes compile to fail.
E. An error at line 6 causes an exception at runtime.