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
Why is actionform a base class rather than an interface?
why static class in java
What are the pros and cons of detached objects?
How would you detect a keypress in a jcombobox?
Which textcomponent method is used to set a textcomponent to the read-only state?
What is a policy?
Explain the different types of memory used by jvm?
Which containers use a border layout as their default layout?
Why use a datasource when you can directly specify a connection details?
How are commas used in the intialization and iteration parts of a for statement?
Which class is the immediate superclass of the menucomponent class?
How would you create a button with rounded edges?
Can we sent objects using Sockets?
whats is mean by connectionpooling
What is the difference between session and entity beans?