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 / jeevan

It is a good programming practice to have only a sub set of
checked exceptions classes from the throws clause of the
inherited method of the superclass.


Here in the above example E2,E3 exception are not a subset
of the exception classes of the inherited method

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When should the method invokelater() be used?

578


How many types of memory areas are allocated by jvm?

558


What are the different http methods?

523


In a class implementing an interface, can we change the value of any variable defined in the interface?

551


Why java is considered dynamic?

748






Is there a sort function in java?

573


What do you mean by aggregation?

561


Difference between arraylist and vector.

580


What are the different types of inner classes?

527


Define how does a try statement determine which catch clause should be used to handle an exception?

578


What is callablestatement? How you can call stored procedure to pass in parameter?

542


What is the java idl system?

579


What is module with example?

507


Which variables are stored in heap?

533


What is anti pattern in cyber security?

517