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


Please Help Members By Posting Answers For Below Questions

Describe, in general, how java's garbage collector works?

540


Are we allowed to change the transaction isolation property in middle of a transaction?

567


what is a non-repeatable read?

1830


Why are component architectures useful?

575


What is Stream Tokenizer?

1732






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??

1105


What are the different types of exception?

572


What is the difference between system.out ,system.err and system.in?

598


Write a singleton program?

572


Can I run seam outside of jboss as?

642


difference between  ejb,struts,hibernate,spring and jsp

2307


Write a program to show synchronization?

694


What method is invoked to cause an object to begin executing as a separate thread?

572


how to use debug in my elipse to solve problems that exist in my project

1766


How database connectivity in XML is achieved?

1769