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
When a thread blocks on i/o?
what is a portable component?
Why do I get a duplicate name error when loading a jar file?
AS a developer will u create a data source in connection pool? If so how will u do that, how to access the object from connection pool using IRAD tool?
What happens when a thread cannot acquire a lock on an object?
In RMI, inorder to sent the stub reference to the client, is we have to load the server object first into the memory or can we directly sent reference to the client?
What are the different types of exception?
How primary key is implemented in Oracle?
What restrictions are placed on the values of each case of a switch statement?
Do you think that java should have had pointers?
What is RMI and what are the services in RMI?
What is prototype?
What is ioc concept?
What are the different algorithms used for clustering?
What is ripple effect?