In this program, You will learn how to implement the default constructor in java.
Main(){
//statemnet
}
class Main {
int x;
Main() {
x = 10;
System.out.println("Default Constructor is called here");
}
void display() {
System.out.println("The Value of x is:" + x);
}
public static void main(String args[]) {
Main t = new Main();
t.display();
}
}
Default Constructor is called here
The Value of x is:10