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.
相关问题推荐
-
What can directly access and change the value of the variable name?()
A、 any class
B、 only the Target class
C、 any class in the test package
D、 any class that extends Target
-
What will be the appearance of an applet with the following init() method? public void init() { add(new Button("hello")); }
A、Nothing appears in the applet.
B、A button will cover the whole area of the applet.
C、A button will appear in the top left corner of the applet.
D、A button will appear, centered in the top region of the applet.
E、A button will appear in the center of the applet.
-
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.
-
Given classes defined in two different files: What is the result of executing XMLMessage.main?()
A、 text
B、 Compilation fails.
C、
text D、 An exception is thrown at runtime.
-
Which two statements are true regarding the return values of property written hashCode and equals methods from two instances of the same class?()
AIf the hashCode values are different, the objects might be equal.
BIf the hashCode values are the same, the object must be equal.
CIf the hashCode values are the same, the objects might be equal.
DIf the hashCode values are different, the objects must be unequal.