单项选择题
public void foo( boolean a, boolean b ){
if( a ) {
System.out.println( “A” );
} else if ( a && b ) {
System.out.println( “A&&B” );
} else { 17. if ( !b ) {
System.out.println( “notB” );
} else {
System.out.println( “ELSE” );
}
}
}
What is correct?()
A. If a is true and b is true then the output is “A&&B”.
B. If a is true and b is false then the output is “notB”.
C. If a is false and b is true then the output is “ELSE”.
D. If a is false and b is false then the output is “ELSE”.
相关考题
-
单项选择题
public class Foo { public void main( String[] args ) { System.out.println( “Hello” + args[0] ); } } What is the result if this code is executed with the command line?()
A. Hello
B. Hello Foo
C. Hello world
D. Compilation fails.
E. The code does not run. -
多项选择题
1. public class OuterClass { 2. private double d1 = 1.0; 3. // insert code here 4. } Which two are valid if inserted at line 3?()
A. static class InnerOne { public double methoda() { return d1; } }
B. static class InnerOne { static double methoda() { return d1; } }
C. private class InnerOne { public double methoda() { return d1; } }
D. protected class InnerOne { static double methoda() { return d1; } }
E. public abstract class InnerOne { public abstract double methoda(); } -
单项选择题
1. public class ReturnIt { 2. return Type methodA(byte x, double y) { 3. return (long)x / y * 2; 4. } 5. } What is the narrowest valid returnType for methodA in line2?()
A. int
B. byte
C. long
D. short
E. float
F. double
