Search Interview Questions
| 3180 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. Yes, we can do that. Compiler wont complain. But using object reference we can only access methods which have been defined for object class i.e clone(), equals(), hashCode(), toString() etc.|
We cannot access methods defined in String class or in any class in hierarchy between String and Object.
For example - we cannot do obj.append("abc") as it will now give compile time error.
|Help us improve. Please let us know the company, where you were asked this question :|
|Like Discuss Correct / Improve object initialization object declaration runtime polymorphism object oriented programming (oops) oops concepts|
|What are the difference between composition and inheritance in Java?|
|What are points to consider in terms of access modifier when we are overriding any method?|
|What is the difference between Encapsulation and Abstraction?|
|Why every object constructor automatically call super() in Object before its own constructors?|
|What is Polymorphism in Java ?|
|Can you give a real world example of Encapsulation and Abstraction ?|
|Difference between Composition and Inheritance ?|
|How compiler handles the exceptions in overriding ?|
|Which of the following is tightly bound ? Inheritance or Composition ?|
|What are the features of encapsulation ?|