What is function in a constructor ?

What is function in a constructor ?

The main function of constructor to do initialisation followed by instantiation.
It is calle to create an object.
A constructor resembles an instance method, but it differs from a method in that it has no explicit return type.  Constructors often have the same name as the declaring class.
Default constructor(no parameter).
Parameterised Constructor (with parameter)

By:Sumit Tripathi
Date:2024-05-15 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related Java Subjective Links

Java Subjective interview questions and answers for experienced and fresher