Default Constructor
Author: Ravi Poswal
The default constructor is automatically created when the user is not creating any constructor in a class.
Syntax:- <class_name> ( ) { }
Code Example
class A
{ int x;
public A()
{
x=5;
}
public static void main(String arg[])
{
A r=new A();
System.out.println(r.x);
}
}
RANREV INFOTECH