So there is this task we are supposed to complete in order to learn how static and dynamic binding works, see the attached image for the code and classes.
C is a subclass of B, and B is a subclass of A.
Line System.out.println(p1.x); prints 1, which is the x defined for Print1 class.
In line p1.print(c); it would be logical to execute method print(B b) from Print1 class, which is also what the IntelliSense suggests is happening.
However actually, it is running the print(B b) method from Print2 class with the x = 3 from Print2.
How is this possible? It seems entirely random to me, especially since it previously used x = 1 from Print1, and it also does not use print(C c) from Print2 while the parameter is a C class.