| IT Certification Practice Exams | HOME | Cisco | CompTIA | CheckPoint | CIW | Microsoft | Books | Bootcamp | Buy Now! |
Java Certification: SCJP - Sun Certified Java Programmer Exam
Practice Questions: Exam SCJP 1.6
|
|
|
|
|
||
|
Q4. Consider these classes, defined in separate source files, public class Test1{ public float aMethod(float a, float b) throws IOException{ }
}
|
||
|
A. float aMethod(float a, float b){} B. public int aMethod(int a, int b) throws Exception{ } C. public float aMethod(float a, float b) throws Exception{ } D. public float aMethod(float p, float q){ }
|
||
|
Correct Answer: B,D
|
||
|
Explanation: B and D are correct. B is legal as it is an example of method overloading. A is illegal because it is less accessible than the original method, because method in Test1 is public. And for any overriding method, accessibility must not be more restricted than the original method. C is illegal because for overriding method, it must not throw checked exception of classess that are not possible for the origincal classes.
|
||
Email: test@simulationexams.com