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
相关问题推荐
-
1. public class OuterClass { 2. private double d1 = 1.0; 3. // insert code here 4. } Which two are valid if inserted at line 3?()
Astatic class InnerOne { public double methoda() { return d1; } }
Bstatic class InnerOne { static double methoda() { return d1; } }
Cprivate class InnerOne { public double methoda() { return d1; } }
Dprotected class InnerOne { static double methoda() { return d1; } }
Epublic abstract class InnerOne { public abstract double methoda(); }
-
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.
-
1. interface TestA { String toString(); } 2. public class Test { 3. public static void main(String[] args) { 4. System.out.println(new TestA() { 5. public String toString() { return “test”; } 6. } 7. } 8. } What is the result?()
A、 test
B、 null
C、 An exception is thrown at runtime.
D、 Compilation fails because of an error in line 1.
E、 Compilation fails because of an error in line 4.
F、 Compilation fails because of an error in line 5.
-
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.
-
What is the result?()
A、 test end
B、 Compilation fails.
C、 test runtime end
D、 test exception end
E、 A Throwable is thrown by main at runtime.