Showing posts with label constructor method. Show all posts
Showing posts with label constructor method. Show all posts

Monday, 20 January 2014

CONSTRUCTORS IN JAVA


A constructor initializes an object immediateily upon creation.It has the same name as the class in which it resides and is syntactically similar to a method.Once defined, the constructor is automatically called immediately after the object is created,before the new operator completes.Constructors look a little strange because they have no return type ,not even void.Attributes of an object may be available when creating objects if no attribute is available then default constructor is called, also some of the attributes may be known initially.