Will it be called overriding if I do not change the
parameters or return type, instead throw a different
exception in the method signature.

Answer Posted / siva

public class MyOverriding {
int add(int a, int b)throws Exception{ //TRUE
return a+b;
}
}
class SubClass extends MyOverriding {
int add(int a, int b)throws NullPointerException{
return a+b;
}
}

//BELOW CODE IS GETTING COMPILER ERROR
public class MyOverriding {
int add(int a, int b)throws NullPointerException{
return a+b;
}
}
class SubClass extends MyOverriding {
int add(int a, int b)throws Exception{
return a+b;
}
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain RMI Architecture?

617


What do you mean by Socket Programming?

561


What is the map interface?

621


Why does the tag url-encode javascript and mailto links?

593


What is the relationship between local interfaces and container-managed relationships?

602






What are the difference between RMI and CORBA?

623


what are the advantages of JTA over JTS?

1679


What is metaspace?

556


Which containers use a border layout as their default layout?

618


Can I have an action without a form?

611


Should synchronization primitives be used on bean methods?

560


Define aop(assepct oriented programing)?

650


Explain how will the struts know which action class to call when you submit a form?

529


A user of a web application sees a jsessionid argument in the URL whenever a resource is accessed. What does this mean? a. The form must have the field jsessionid b. URL rewriting is used as the session method c. Cookies are used for managing sessions

1823


What is the difference between the session.update() method and the session.lock() method?

564