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
State whether the following statement is True or False :
A constructor is likely to be defined after the class declaration.
State whether the following statement is True or False :
Copy constructor copies functions from one object to another.
What is meant by a constructor?
Name the different types of constructors used while defining a class.