How to instantiate non static inner class within a static method?

You have to have a reference to the other outer class as well.

Inner inner = new MyClass().new Inner();

If Inner was static then it would be

Inner inner = new MyClass.Inner();

Leave a Comment