Today I ran into this error in our code, and it took some time. I found this interesting, so I decided to share it. Here is a simplified version of the problem:
public class Test { static { text = "Hello"; } public static String getTest() { return text + " World"; } private static String text = null; }
Guess what Test.getTest(); returns Test.getTest(); and why?
Caner
source share