What is the difference between a constructor and a method?



What is the difference between a constructor and a method?..

Answer / Chandan Rai

A constructor is a special method that is used to create an object, it has the same name as the class. A constructor initializes the instance variables of the object and can perform other tasks such as setting default values. A method, on the other hand, does not have the same name as the class and can be used to perform operations on objects.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

Explain a few methods of overloading best practices in java?

1 Answers  


Can I declare class as static or private?

1 Answers  


Is 0 an irrational number?

1 Answers  


How does arraylist work in java?

1 Answers  


State two differences between C and Java.

1 Answers   Syntel, Visa,


What is the nested interface?

1 Answers  


why use interface? if interface declear a method implement in class. why direct implement method in class

1 Answers   HCL,


where to use join method and explain with real time senario?and programatical explenation also..

1 Answers   TCS,


What is thread start?

1 Answers  


Keywords in Exceptions?

2 Answers  


What is quick sort in java?

1 Answers  


What is array class in java?

1 Answers  


Categories