In this program, You will learn how to implement static variables methods and blocks in java.
static int x;
static void display() {
//statement
}
static {
//statement
}
class Main {
static int x = 10;
static {
System.out.println("static block is called here");
}
static void display() {
System.out.println("x value is :" + x);
}
public static void main(String args[]) {
display();
}
}
static block is called here
x value is :10