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

what are memory considerations of jsp compares to other web components?

6268


Are there books about seam?

841


What are the types of scaling?

798


Can we sent objects using Sockets?

865


What is Remote Server?

1889


Explain what is orm?

866


What is the purpose of the wait(), notify(), and notifyall() methods?

794


What is abstract schema?

769


To what value is a variable of the string type automatically initialized?

874


What is aop(assepct oriented programing)?

793


What do you know about seam?

779


What is mdb and what is the special feature of that?

802


Why use a datasource when you can directly specify a connection details? (in a J2EE application)

3847


How primary key is implemented in Oracle?

2144


how i secure my site with the https protocol.what are the steps?

1966