Java: Instantiate an innerclass from the main constructor does not work.

public class Main { public static void main(String[] args) { Test t = new Test(); System.out.println(t.getInt()); } public class Test { public Test() { } public int getInt() { return 5; } } } While it works in C#: class Program { static void Main(string[] args) { Test t = new Test(); Console.WriteLine(t.GetInt()); Console.ReadLine(); } […]