Differentiate constructor and a method and how are it be
used?

Answer Posted / devarathnam c,kotagudibanda(po

Hi...
Constructor(): It is also a method but it doesnot allow
return type even void also.It will call automatically
whenever an object is created of a appropriate class.
But class name and constructor should be the same.d
Method():U have to call explicitly .

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is an objects lock and which objects have locks? : Java thread

524


Is arraylist ordered in java?

566


Can we declare an array without size in java?

515


What is class array in java?

503


Given a singly linked list, how will you print out its contents in the reverse order? Can you do it with consuming any extra space?

598






How long will it take to learn java?

500


Explain 5 io best practices?

589


Can private method static?

471


What is difference between final and finally in java?

580


What java ide should I use?

560


What is the intersection and union methods?

541


What is difference between stringbuffer and string?

488


Define iterator and methods in iterator?

542


What is the epoch date?

564


Explain the purpose of garbage collection in Java?

566