Constructor in java

  • Constructor :
  • Constructor is a block method that similar class name,
  • Constructor dose not used any return type for example - void,
  • Constructor are usage only modifire ( public, protected and private),
For example
            
      Class Test()
  {  
       public Test() 
                 {
                 
                 } 
          public static void main( String [] args)
            {
               Test t= new Test() ;
             } 
    } 
    
  Constructor types :-      
   Constructor are three types, 

  • Default Constructor
  • User defined Constructor (no argument)
  • User define Constructor ( present argument) 

Comments