I was going through java code snippets and this one snippet I am not able to figure out why the output is 2?
package com.instanceofjava;
public class A{
static int a = 1111;
static
{
a = a-- - --a;
}
{
a = a++ + ++a;
}
public static void main(String[] args) {
System.out.println(a);
}
}
Can somebody explain why the output is 2 for this code snippet.