The compiler creates a default constructor only when there are no other constructors for the class. The default constructor has the same access as its class. The default constructor invokes the no-arg constructor of the superclass. The default constructor initialises method variables. If a class lacks a no-arg constructor, the compiler always creates a default constructo
Answers
Answered by
0
Answer:
The compiler gives default constructors the same access level as their class. In the example above, class CoffeeCup is public, so the default constructor is public. If CoffeeCup had been given package access, the default constructor would be given package access as well.
Answered by
0
Answer:
The parameterized constructors are the constructors having a specific number of arguments to be passed. The purpose of a parameterized constructor is to assign user-wanted specific values to the ins.tance variables of different objects. A parameterized constructor is written explicitly by a programmer.
Similar questions