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),
Class Test()
{
public Test()
{
}
public static void main( String [] args)
{
Test t= new Test() ;
}
}
public Test()
{
}
public static void main( String [] args)
{
Test t= new Test() ;
}
}
Constructor types :-
Constructor are three types,
Constructor are three types,
- Default Constructor
- User defined Constructor (no argument)
- User define Constructor ( present argument)
Comments
Post a Comment