Why does this code print 11 and not 10. Clearly , i++ in the static initialization block is executed.
But , why i-- in the non-static block is not executed.
What's happening here ?
class ClassOne
{
static int i = 10;
{
i--;
}
}
public class Main extends ClassOne
{
static
{
i++;
}
public static void main(String[] args)
{
System.out.println(i);
}
}