Powered by Blogger.

What is the use of Constructor.?

>> Friday, March 18, 2011


A constructor is automatically called and executed at the time of creating an object.


  • It  is used to initialize the instance variables of a class.
  • It is used to create an Object of a class.


Example:



[code]

public class Con{
   Con(){
          ----
         -----
       }
}

[/code]

Related Posts Plugin for WordPress, Blogger...
© javabynataraj.blogspot.com from 2009 - 2022. All rights reserved.