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
How can I avoid validating a form before data is entered?
What are the design considerations while making a choice between using interface and abstract class?
Name the eight primitive java types.
Why a client should be multithreading? Explain.
what is meant by JRMP?
Difference between DurableSubscription and non- DurableSubscription?
Explain about local interfaces.
What are the different approaches to represent an inheritance hierarchy?
What is a clone?
What is TL and its use?
what is an isolation level?
What value does readline() return when it has reached the end of a file?
How can I scroll through list of pages like the search results in google?
Why do I get a duplicate name error when loading a jar file?
how i secure my site with the https protocol.what are the steps?