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

 
 

Share on Google+Share on Google+
SCJP Module-4 Question-6
Posted on: July 9, 2010 at 12:00 AM
Advertisement
The sample program given below tests your understanding of method overloading and method overriding in Java.

Given the following sample code:

public class Example5{
public float Twin(float a, float b) {...
}
public float Twin(float a1, float b1) { ...}

}

How can above code will be corrected without changing the 'method's name', 'type' & 'number' of argument?

1.by changing the name of the argument.

2.by changing the body (code between braces)

3.by changing name of the class

4.by putting one method into another subclass of this class

Answer :

(4)

Explanation :

By putting one method into another subclass of this class, will correct this code. After this change overloading is converted into overriding.

Advertisement

Related Tags for SCJP Module-4 Question-6:


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
 

 

 

DMCA.com