SCJP Module-4 Question-18


 

SCJP Module-4 Question-18

The program given below tests your knowledge of Inheritance and method overloading in core Java.

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)

Ads