Share on Google+Share on Google+

SCJP Module-4 Question-18

The program given below tests your knowledge of Inheritance and method overloading in core 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 we correct the above code ?

1. By placing overriding method into subclass.

2. By changing the type of the arguments of overriding method.

3. By replacing overloading from overriding.    

4. By changing the name of the function.

Answer :

All of the above : (1),(2),(3) & (4)


Posted on: July 10, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial 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.