Core Java Interview Questions Page 4

Core Java Interview Questions :


16) What is the purpose of default constructor?

The default constructor provides the default values to the objects. The java compiler creates a default constructor only if there is no constructor in the class.more details...

17) Does constructor return any value?

Ans:yes, that is current instance (You cannot use return type yet it returns a value).more details...

18) Is constructor inherited?

No, constructor is not inherited.

19) Can you make a constructor final?

No, constructor can't be final.

20) What is static variable?

Static variable is used to refer the common property of all objects (that is not unique for each object) e.g. company name of employees,college name of students etc.
static variable gets memory only once in class area at the time of class loading.

Core Java Interview Questions

                                                                                     Next Page >>