package qwertyuiop;
public class Confusion {
Confusion com = new Confusion();
public static void main(String[] args) {
Confusion con = new Confusion();
System.out.println(4);
con.A();
System.out.println(5);
}
public void B() {
System.out.println(3);
}
public void A() {
System.out.println(4);
com.B();
System.out.println(4);
}
}
I know the code is wrong but I am interested in knowing why this is throwing StackOverflowError
. I would also like to know how this code is executing internally.