As i read every one is saying static block will be executed first but when i run a piece of code i found that static variable is loading first.Now this is confusing me please give a proper explanation.
Code
public class MyClass
{
static int x=show();
static
{
System.out.println("Hello Mayar");
}
public static int show()
{
System.out.println("Hello Show");
return 1;
}
public static void main(String a[])
{
System.out.println("Hello Main");
}
}
Output
Hello Show
Hello Mayar
Hello Main