单项选择题

public class Test { 
public static void main(String [] args) { 
int x =5; 
boolean b1 = true; 
boolean b2 = false; 
if((x==4) && !b2) 
System.out.print(”l “); 
System.out.print(”2 “); 
if ((b2 = true) && b1) 
System.out.print(”3 “); 
}
} 
What is the result?() 

A. 2
B. 3
C. 1 2
D. 2 3
E. 1 2 3
F. Compilation fails.
G. Au exceptional is thrown at runtime.


您可能感兴趣的试卷

你可能感兴趣的试题

1.多项选择题

10. public class Bar { 
11.static void foo(int...x) { 
12. // insert code here 
13. } 
14. } 
Which two code fragments, inserted independently at line 12, will allow the class to compile?()

A. foreach(x) System.out.println(z);
B. for(int z : x) System.out.println(z);
C. while( x.hasNext()) System.out.println( x.next());
D. for( int i=0; i< x.length; i++ ) System.out.println(x[i]);

4.单项选择题A Button is positioned in a Frame. Only height of the Button is affected by the Frame while the width is not. Which layout manager should be used?()    

A. FlowLayout
B. CardLayout
C. North and South of BorderLayout
D. East and West of BorderLayout
E. GridLayout

6.多项选择题

public class Parent {    
int change() {…}    
} 
class Child extends Parent { 
   } 
Which methods can be added into class Child?()    

A. public int change(){}
B. int chang(int i){}
C. private int change(){}
D. abstract int chang(){}

7.多项选择题Which of the following statements are legal?()         

A. long l = 4990;
B. int i = 4L;
C. float f = 1.1;
D. double d = 34.4;
E. double t = 0.9F;

8.多项选择题

String s= "hello";    
String t = "hello"; 
char c[] = {’h’,’e’,’l’,’l’,’o’} ;    
Which return true?()   

A. s.equals(t);
B. t.equals(c);
C. s==t;
D. t.equals(new String("hello"));
E. t==c;

9.单项选择题Which expressions are correct to declare an array of 10 String objects? ()   

A. char str[];
B. char str[][];
C. String str[];
D. String str[10];

10.单项选择题A public member vairable called MAX_LENGTH which is int type, the value of the variable remains constant value 100. Use a short statement to define the variable.()   

A. public int MAX_LENGTH=100;
B. final int MAX_LENGTH=100;
C. final public int MAX_LENGTH=100;
D. public final int MAX_LENGTH=100;