The program given below test your aptitude of Inheritance and method overloading and prepare you for SCJP exam.
The program given below test your aptitude of Inheritance and method overloading and prepare you for SCJP exam.Given the following sample code:
Example3{
void Twin(int a, float b) { System.out.println("Hello ");}
}
class SubExample3 extends Example3{
public void Twin(int a, float b)throws java.io.IOException
{
System.out.println("Hello "); }
}
1. By removing the "throws" clause.
2. By changing the type of arguments of overriding method.
3. By increasing the number of arguments.
4. Correction is not needed.
(1)
"IOException" is not compatible with "throws" clause .