Hi I had a doubt about the instantiation of inner class�
From what I know instantiation of an inner class requires an object of outer class, except when the inner class is instantiated within the outer class itself.
public class outer{
class inner{
}
inner in = new inner();// (1) valid
public static void main(
String []args){
inner in = new inner();// (2) not valid outer class object reqd.
}
}
On similar lines consider this example�
interface outer{
class inner{
}
}
public class outer2 implements outer{
public static void main(String args[]){
inner in = new inner(); // (3) valid
}
}
So my question is
1.Why cant we instantiate an inner class in a static method of outer class.
2.And why can we do the same in a class which implements the interface of the outer class.
Thanks in advance�