class One { public One() { System.out.print(1); } } class Two extends One { public Two() { System.out.print(2); } } class Three extends Two { public Three() { System.out.print(3); } } public class Numbers{ public static void main( String[] argv) { new Three(); } } What is the result when this code is executed?()
A、 1
B、 3
C、 123
D、 321
E、 The code rims with no output.
相关问题推荐
-
class Base { Base() { System.out.print(“Base”); } } public class Alpha extends Base { public static void main( String[] args ) { new Alpha(); new Base(); } } What is the result?()
A、 Base
B、 BaseBase
C、 Compilation fails.
D、 The code runs with no output.
E、 An exception is thrown at runtime.
-
Runnable r = new Runnable() { public void run() { System.out.print(”Cat”); } }; Threadt=new Thread(r) { public void run() { System.out.print(”Dog”); } }; t.start(); What is the result?()
A、 Cat
B、 Dog
C、 Compilation fails.
D、 The code runs with no output.
E、 An exception is thrown at runtime.
-
int I=1, j=0 switch(i) { case 2: j+=6; case 4: j+=1; default: j +=2; case 0: j +=4; } What is the value of j at line 16?()
A0
B1
C2
D4
E6
-
16. Date d = new Date(0L); 17. String ds = “December 15, 2004”; 18. // insert code here What updates d‟s value with the date represented by ds?()
A、 18. d = df.parse(ds);
B、 18. d = df.getDate(ds);
C、 18. try { 19. d = df.parse(ds); 20. } catch(ParseException e) { };
D、 18. try { 19. d = df.getDate(ds); 20. } catch(ParseException e) { };
-
10. public class MyClass { 11. 12. public Integer startingI; 13. public void methodA() { 14. Integer i = new Integer(25); 15. startingI = i; 16. methodB(i); 17. } 18. private void methodB(Integer i2) { 19. i2 = i2.intValue(); 20. 21. } 22. } If methodA is invoked, which two are true at line 20?()
Ai2 == startingI returns true.
Bi2 == startingI returns false.
Ci2.equals(startingI) returns true.
Di2.equals(startingI) returns false.