Explain difference between Constructer and a method

Explain difference between Constructer and a method

Constructors are the special member, they do not have a return type. We can call the methods explicitly but constructors are called automatically when we create the object using the new operator. The purpose of constructor is to allocate the memory to the object and initialize the class\' variables. If you don\'t provide the constructor in your class, the compiler will insert the default constructor.

By:Jalees
Date:2014-01-09 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