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
What is the difference between the ‘font’ and ‘fontmetrics’ class?
How messaging services are done, before release of JMS?
What state does a thread enter when it terminates its processing?
Whats new with the stop(), suspend() and resume() methods in jdk 1.2?
how to use debug in my elipse to solve problems that exist in my project
A user of a web application sees a jsessionid argument in the URL whenever a resource is accessed. What does this mean? a. The form must have the field jsessionid b. URL rewriting is used as the session method c. Cookies are used for managing sessions
What are various types of class loaders used by jvm?
What is the purpose of the notifyall() method?
What is table mutation and how do you avoid it?
What are the different methods of identifying an object?
Name three component subclasses that support painting?
What’s jboss cache in short?
Can I run seam with jdk 1.4 and earlier?
If we opened Windows Internet Explorer 4 times, does it starts 4 processes or 4 threads?
Define prototype?