public class TestClass(){ public static void main(String []args) { TestClass t1 = new TestClass(); t1.anything(); } }
Is it not
You would only have an infinite loop (stack overflow error) if you tried to do the below:
public class TestClass { public TestClass() { TestClass t = new TestClass(); } }
And elsewhere, you try to create an object of the class TestClass.
TestClass