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
Which textcomponent method is used to set a textcomponent to the read-only state?
What is the difference between the string and stringbuffer classes?
Explain about RMI Architecture?
What are the benefits of detached objects?
What are the call back methods in entity bean?
Name three component subclasses that support painting?
What is a policy?
Explain about local interfaces.
What is colon_pkg_prefixes and what is its use?
what is meant by JRMP?
What are the different types of exception?
What is the difference between long.class and long.type?
Why use a datasource when you can directly specify a connection details? (in a J2EE application)
Why won’t the jvm terminate when I close all the application windows?
Are enterprise beans allowed to use thread.sleep()?