Hey Guys,
I have the following code.
public class Main {
static int a = 3;
static int b;
static void math(int x) {
System.out.println("x = " + x);
System.out.println("a = " + a);
System.out.println("b = " + b);
}
public static void main(String[] args) {
math(100);
}
static {
b = a * 4;
}
}
When I ran the above program, the control first went to intialise the variable a, then static method in which variable b is calculated and then it went to the main method.
Can someone explain me why it doesn't first go to the main method?