KnowledgeBoat Logo

Computer Applications

While creating a class, a specific method called constructor is defined to initialise the instance variables. Such method may or may not use parameters. In a case where the constructor is not defined in the class, the system creates on its own to put the default initial value to the instance variables. The initial values can also be duplicated from one instance to another.

Based on the above discussion, answer the following questions:

(a) Which name resembles with the constructor name?

(b) What type of constructor is used with parameters?

(c) What type of constructor initialises the instance variables with default value?

(d) Which constructor is used to duplicate the initial values from one constructor to other?

Java Constructors

14 Likes

Answer

(a) Class name

(b) Parameterised constructor

(c) Default constructor

(d) Copy constructor

Answered By

10 Likes


Related Questions