Core Java interview questions on Inheritance

1.What is inheritance?
Child class acquires the properties of parent class.

2.Does java support multiple inheritance?

3.Why multiple inheritance not supported in java?
Because ambiguous  

4.What is the base class of all classes?

5.What is an object class?
Object is a instance of class.

6.Is constructor inherited?

In simple words, a constructor cannot be inherited,
since in subclasses it has a different name (the name of the subclass).

class A {

class B extends A{

You can do only:

B b = new B();  // and not new A()

7.What is super.(dot)keyword in java?
It is a reference variable that is used to refer immediate parent class object.

Related Post