jump to navigation

Difference between a constructor and a method November 19, 2006

Posted by :) in JAVA.
trackback

A constructor is a member function of a class that is used to create objects of that class. It has the same name as the class itself, has no return type, and is invoked using the new operator.
 A method is an ordinary member function of a class. It has its own name, a return type (which may be void), and is invoked using the dot operator.

Comments»

1. manohar - June 8, 2008

the terminology is quite easy to understand.i make sure to approach this site whenever i come across a problem.

2. bangarraju - September 14, 2008

i want to know about interfaces. how interfaces are different from abstract classes? please explain me

thank you