public class outer1{
private static class inner {}
public static void main(
String[] args) {
outer1.inner i = new outer1().new inner();
//outer1 o = new outer1();
//outer1.inner i = o.new inner();
//outer1 o = new outer1();
//inner i = o.new inner();
}}
Can u explain why this gives runtime error. Pls note i have made the inner class static.
Also i have read that non-static inner class do NOT need the enclosing class instance to be instantiated. Can u explain this with example?