what diff bw constructor method & method

Answer Posted / sowjanya

constructor is special method with the basic initialization
information of the class variables.this constructor is
accessed at the time of object creation .from this object is
created with initial assignment values of variables. and we
can't call constructor separately.
if you have more than one constructor default constructor is
invoked at the object creation time and we can call other
constructor as we need .
constructor name is same as class name this is way to
identify methods is constructor.
methods are not invoked not default we call that as we
need.method name is not a class name.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

In system.out.println(), what is system, out and println?

785


What is orm in java?

672


What is javacpl?

679


What is entitymanager in java?

674


can a program use more than one command-line argument?

658


What is reflection in java?

643


What is java language expression?

660


Do I need both jdk and jre?

679


What about products that claim to block java applets at a firewall? : java security

706


Can the main method be declared final?

714


Explain suspend() method under thread class>

813


Which type of stream is in java?

656


How do I open java console?

652


What are the authentication modes in asp.net? : java security

663


Why are lambda functions called lambda?

649