Java Reference
In-Depth Information
what is the result of the following statement?
new Child().printResults(0);
A.
In Parent
B.
In Child
C.
0
D.
Line 2 generates a compiler error.
E.
Line 8 generates a compiler error.
14.
Given the following enum declaration:
1. public enum Flavors {
2. VANILLA, CHOCOLATE, STRAWBERRY
3. }
what is the result of the following statement?
System.out.println(Flavors.CHOCOLATE.ordinal());
A.
0
B.
1
C.
CHOCOLATE
D.
9
E.
The statement will not compile.
15.
What is the result of the following program?
1. class Parent {
2. public float computePay(double d) {
3. System.out.println(“In Parent”);
4. return 0.0F;
5. }
6. }
7.
8. public class Child extends Parent {
9. public double computePay(double d) {
10. System.out.println(“In Child”);
11. return 0.0;
12. }
13.
14. public static void main(String [] args) {
15. new Child().computePay(0.0);
16. }
17. }
Search WWH ::
Custom Search