By candid | Posted :
Jun 12, 2016
| Updated :
Jun 12, 2016
1.What is constructor?
It is a special method it calls its own it is used for creating objects
2.What is the purpose of default constructor?
The default constructor implicitly calls the super class?s nullary constructor, then executes an empty body. All fields are left at their initial value of 0 (integer types), 0.0 (floating-point types), false (boolean type), or null (reference types).
3.Does constructor return any value?
Constructors cannot return a value; they return the constructed object.
4.Use of this() in java?
this() can be used to invoke current class constructor.
5.Use of super() in java?
super() is used to invoke immediate parent class constructor.
6.Can you use this() and super() both in a constructor?
Cannot be used because we cannot create boj for parent and sub class both at same time