|
|
|
|
|
|
|
SCJP Mock Exam Answers
A1)
Answer : A
Explanation :
- B) Option B is incorrect. The method get() is overridden in class SubCafe4Java class. In Java5, an overriding method can define a return type, which is a sub-class of the return type of the method in the super class. In case of overridden methods, the method that is invoked depends on the type of the actual object on which it is invoked, and not on the type of the reference variable, which is used to refer to an object.
- C) Option C is incorrect. The method get() is overridden in class SubCafe4Java class. In Java5, an overriding method can define a return type, which is a sub-class of the return type of the method in the super class. In case of overridden methods, the method that is invoked depends on the type of the actual object on which it is invoked, and not on the type of the reference variable, which is used to refer to an object.
- D) Option D is incorrect. The method get() is overridden in class SubCafe4Java class. In Java5, an overriding method can define a return type, which is a sub-class of the return type of the method in the super class. In case of overridden methods, the method that is invoked depends on the type of the actual object on which it is invoked, and not on the type of the reference variable, which is used to refer to an object.
- E) Option E is incorrect because the code compiles successfully.
- F) Option F is incorrect because the code executes without any exceptions.
- G) Option G is incorrect because the code executes without any errors.
<<<< Return to Q1 <<<<<
>>>> Go to Q2 >>>>
Submit your feedback on this mock exam
|
|
|
| |
|
|
|
| |
|
Copyright©2008 Cafe4Java.com. All rights reserved.
|
|
| |
|
|
|
|