Question: Which of the following is/are true about constructors in Java? Check all that apply. 1. Constructor name should be same as class name. 2. A
Which of the following is/are true about constructors in Java? Check all that apply.
| 1. Constructor name should be same as class name. | ||
| 2. A compilation error will occur if a call to super is not written as the first statement in a constructor | ||
| 3. If you do not define a constructor for a class, a default parameterless constructor is automatically created by the compiler. | ||
| 4. The default constructor calls super() and initializes all instance variables to default value like 0, null. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
