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

 
 

SCJP Module-4 Question-6
Posted on: July 9, 2010 at 12:00 AM
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.

Related Tags for SCJP Module-4 Question-6:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.