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


Share on Google+Share on Google+
SCJP Module-4 Question-19
Posted on: July 10, 2010 at 12:00 AM
The program given checks tests your knowledge for method overriding 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 {
float Twin(float x, float y) {
return 0;

How can we correct above code ?

1. no need for correction.

2. By changing the method's argument name

3. By removing overridden method 's access specifier(i.e public).

4. By adding access specifier 'public'  to the overriding method.

Answer :

(3) & (4).

Explanation :

The overriding method must not limit access more than the overridden method i.e. the 'Twin' method in "Subexample7" doesn't have "public" access specifier.


Related Tags for SCJP Module-4 Question-19:

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 10, 2010

Recommend the tutorial

Advertisements Advertisements