Search Interview Questions
| 3306 questions in repository.|
There are more than 200 unanswered questions.
Click here and help us by providing the answer.
Have a video suggestion.
Click Correct / Improve and please let us know.
|Java - Interview Questions and Answers|
|Ans. 1)The overriding methods can throw any runtime Exception , here in the case of runtime exception overriding method (subclass method) should not worry about exception being thrown by superclass method.|
2)If superclass method does not throw any exception then while overriding, the subclass method can not throw any new checked exception but it can throw any runtime exception
3) Different exceptions in java follow some hierarchy tree(inheritance). In this case , if superclass method throws any checked exception , then while overriding the method in subclass we can not throw any new checked exception or any checked exception which are higher in hierarchy than the exception thrown in superclass method
|Help us improve. Please let us know the company, where you were asked this question :|
|Like Discuss Correct / Improve  java   overriding   exceptions   inheritence   inheritance  object oriented programming (oops)  oops concepts   oops|
|What are the difference between composition and inheritance in Java?|
|What is the difference between Encapsulation and Abstraction?|
|What are points to consider in terms of access modifier when we are overriding any method?|
| Explain OOPs |
Explain OOPs Principles
Explain OOPs Concepts
Explain OOPs features
Tell me something about OOPs
|What is Polymorphism in Java ?|
|Why every object constructor automatically call super() in Object before its own constructors?|
|Can you give a real world example of Encapsulation and Abstraction ?|
|Difference between Overloading and Overriding ?|
|Difference between Composition and Inheritance ?|