The code 1:
public class StaticBlockExample1
{
static { value = 20; }
static int value = 10;
public static void main(String[] args) {
System.out.println(" Value = " + value);
}
}
output of StaticBlockExample1 is 10
The code 2:
public class StaticBlockExample2
{
static int value = 10;
static { value = 20; }
public static void main(String[] args)
{
System.out.println(" Value = " + value);
}
}
output of StaticBlockExample2 is 20.
Am confused with outputs of the above examples. is there any significance to declare static variable before or after static block?