Java Reference
In-Depth Information
C. Browser.addToFavorites(102, “a“);
D. Browser.addToFavorites(103, 104, 105);
E. Browser.addToFavorites(106, “x”, “y”, “z“);
12. Suppose we have the following class definition:
1. public class Outer {
2. private int x = 5;
3.
4. protected class Inner {
5. public static int x = 10;
6.
7. public void go() {
8. System.out.println(x);
9. }
10. }
11.}
Given the following code:
15. Outer out = new Outer();
16. Outer.Inner in = out.new Inner();
17. in.go();
which of the following statements are true?
A. The output is 10.
B. The output is 5.
C. Line 16 generates a compiler error.
D. Line 5 generates a compiler error.
13. Given the following class definitions:
1. class Parent {
2. public void printResults(String... results) {
3. System.out.println(“In Parent”);
4. }
5. }
6.
7. class Child extends Parent {
8. public int printResults(int id) {
9. System.out.println(“In Child”);
10. return 0;
11. }
12.}
Search WWH ::




Custom Search