class A{
some variables;
public void a()throws Excepion1,Exception2{....}
}
class B extends A{
variables...
public void a()throws E2,E3{.....}
}
Qns:
here override of methods occurs or not,ore else wil give
any compilation error or run properly..plz tell me briefly
whts happening with the above codes....
Answer Posted / anjan singh
while overriding, you must keep in mind that the exception
being thrown by overriding method(method in subclass)
should not throw a broader exception than what is already
thrown by method in super class. one exception is that, you
can always throw RuntimeException from method in subclass.
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Can long be null in java?
Name some OOPS Concepts in Java?
How many types of flags are there?
Assume a thread has lock on it, calling sleep() method on that thread will release the lock?
Can we use different return types for methods when overridden?
What occurs when an object is constructed?
What is a vararg?
What are the elements of java?
Can we call the constructor of a class more than once for an object?
What is the maximum size of arraylist in java?
Can we have two methods in a class with the same name?
What is boolean flag in java?
What do you mean by an object in java?
What are constants?
Is string serializable in java?