What is the result?()
A、 hi hi
B、 hi world
C、 world world
D、 Compilation fails.
E、 An exception is thrown at runtime.
相关问题推荐
-
public class Score implements Comparable { private int wins, losses; public Score(int w, int 1) { wins = w; losses = 1; } public int getWins() { return wins; } public int getLosses() { return losses; } public String toString() { return “”; } // insert code here } Which method will complete this class?()
A、 public int compareTo(Object o) {/*mode code here*/}
B、 public int compareTo(Score other) {/*more code here*/}
C、 public int compare(Score s1,Score s2){/*more code here*/}
D、 public int compare(Object o1,Object o2){/*more code here*/}
-
1. class A implements runable ( 2. int i; 3. public void run () ( 4. try ( 5. thread.sleep(5000); 6. i= 10; 7. ) catch(InterruptedException e) {} 8. ) 9. ) 10. 11. public class Test { 12. public static void main (string args) ( 13. try ( 14. A a = new A (); 15. Thread t = new Thread (a); 16. t.start(); 17. 18. int j= a.i; 19. 20. ) catch (Exception e) {} 21. ) 22. ) Which statement al line 17 will ensure that j=10 at line 19?()
A、 a.wait();
B、 t.wait();
C、 t.join();
D、 t.yield();
E、 t.notify();
F、 a.notify();
G、 t.interrupt();
-
1.class TestSuper { 22.TestSuper(int i) { } 3. } 4.class TestSub extends TestSuper{ } 5.class TestAll { 6.public static void main (String [] args) { 7.new TestSub(); 8.} 9.} Which is true?()
A、 Compilation fails.
B、 The code runs without exception.
C、 An exception is thrown at line 7.
D、 An exception is thrown at line 2.
-
1. public class returnIt ( 2. returnType methodA(byte x, double y) ( 3. return (short) x/y * 2; 4. ) 5. ) What is the valid returnType for methodA in line 2?()
A、 Int
B、 Byte
C、 Long
D、 Short
E、 Float
F、 Double
-
Which two code fragments represent these relationships?()
Aclass Widget{Sprocket s;};class Gadget extends Widget{Spring s;}
Bclass Widget{};class Gadget extends Widget{Spring s1; Sprocket s2;}
Cclass Widget{Sprocket s1; Spring s2;};class Gadget extends Widget{}
Dclass Gadget{Spring s;};class Widget extends Gadget{Sprocket s;}
Eclass Gadget{};class Widget extends Gadget{Sprocket s1; Spring s2;}
Fclass Gadget{Spring s1; Sprocket s2;};class Widget extends Gadget{}