I have this code that appeared in a quiz
public class Main {
public static void main(String[] args) {
class b {
int i = 32;
b() { b(); }
void b() { System.out.println(++i); }
}
class d extends b {
int i = 8;
d() {}
void b() { System.out.println(--i); }
}
b b = new d();
}
}
What should be the output? It turns out that the answer is -1 while I expected it to be 7. Is java broken?