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
Describe, in general, how java's garbage collector works?
Are we allowed to change the transaction isolation property in middle of a transaction?
what is a non-repeatable read?
Why are component architectures useful?
What is Stream Tokenizer?
when A client sent a request to the server to open facebook page and close the browser after this request .at that time the same user do login by using a different browser then that session id will exist or not for the same client??
What are the different types of exception?
What is the difference between system.out ,system.err and system.in?
Write a singleton program?
Can I run seam outside of jboss as?
difference between ejb,struts,hibernate,spring and jsp
Write a program to show synchronization?
What method is invoked to cause an object to begin executing as a separate thread?
how to use debug in my elipse to solve problems that exist in my project
How database connectivity in XML is achieved?