Java Reference
In-Depth Information
9. System.out.println(message + x);
10. }
11. }
12. Inner in = new Inner();
13. in.printX();
14. return x;
15. }
16.}
what is the result of the following statement?
new Outer().getX();
A.
x is 24
B.
x is 0
C.
Compiler error on line 7
D.
Compiler error on line 9
E.
Compiler error on line 12
23.
Given the following class definitions:
1. class Parent {
2. public void print(double d) {
3. System.out.print(“Parent”);
4. }
5. }
6.
7. class Child extends Parent {
8. public void print(int i) {
9. System.out.print(“Child”);
10. }
11.}
what is the result of the following code?
15. Child child = new Child();
16. child.print(10);
17. child.print(3.14);
A.
ChildParent
B.
ChildChild
C.
ParentParent
D.
Line 8 generates a compiler error.
E.
Line 17 generates a compiler error.
Search WWH ::
Custom Search