I have a doubt in Static Inner Class- Question form K & B Book pg 665.code is :->
class MyOuter{
public static class Inner{
public static void foox(){}
}
}
public class Test11{
public static void main(
String args[])
{
//MyOuter.Inner m= new MyOuter.Inner();//correct
MyOuter m=new MyOuter();
MyOuter.Inner mi=m.new MyOuter.Inner();//WRONG
}
}
-------------------------------
In this Question ,we have to tell correct instantion of inner class.
one is ,with outer class'es Name only,no oter instance, needed.
2nd one ,i tried ,its compiler error .but i could nit justfy the reason.
As with static member,s Right way to access is CLASSNAME.VARNAME ...but still not illegal way is OBJNAME.VARNAME
why its not feasibile in staticinner class class.
it outerobj.new inner();