I tried to run the below code
static int j = f();
static int i = 10;
static int f(){
return i;
}
public static void main(String[] args) {
System.out.println("i="+i);
System.out.println("j="+j);
}
It produces the output as
i=10
j=0
Can anyone explain why is j=0 ?