Given below the sample code :
import java.io.IOException;
class Example7 {
public float Twin(float x, float y)
throws IOException {
return 0;
}
}
class SubExample7 extends Example7 {
public
float Twin(float x, float y) {
return 0;
}
}
Is the above code run successfully ?Choose correct options :
1. No , overloading is not perfectly implemented.
2. No , Overriding is not implemented correctly.
3. Yes, Overriding is implemented correctly.
4. Will give compile error.
(3)
The overriding method must not throw any exceptions that may not be thrown by the overridden method. Here , the overriding method "Twin" doesn't throw any exception ,which is perfectly all right.
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.