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
What is colon_pkg_prefixes and what is its use?
what are getters and setters in Java with examples?
What are callback interfaces?
Can you control when passivation occurs?
What is the difference between a static and a non-static inner class?
Java is fully object oriented languages or not?
Do you think that java should have had pointers?
Are there books about seam?
Where can I ask questions and make suggestions about seam?
How would you create a button with rounded edges?
What is the map interface?
What is abstract schema?
What is the difference between the font and fontmetrics classes?
Why do threads block on i/o?
Brief description about local interfaces?