Home Tutorial Java Scjp Part4 SCJP Module-4 Question-8


Share on Google+Share on Google+
SCJP Module-4 Question-8
Posted on: July 9, 2010 at 12:00 AM
The program given below tests your understanding of inheritance and method overloading in core java.

Given below the sample code :

import java.io.IOException;

class Example7 {
public float Twin(float x, float y)
throws IOException {
return 0;

class SubExample7 extends Example7 {
public float Twin(float x, float y) {
return 0;

Is the above code run successfully ?Choose correct options :

1. No , overloading is not perfectly implemented.

2. No , Overriding is not implemented correctly.

3. Yes, Overriding is implemented correctly.

4. Will give compile error.

Answer :


Explanation :

The overriding method must not throw any exceptions that may not be thrown by the overridden method. Here , the overriding method "Twin"  doesn't throw any exception ,which is perfectly all right.


Related Tags for SCJP Module-4 Question-8:

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 9, 2010

Recommend the tutorial

Advertisements Advertisements