package Chapter8;

public class StaticMethodLocalInnerClass {
public static void main(String arg[])
{
        Outer2 outOb=new Outer2();
        outOb.doStuff();
}
}
class Outer2{
        static int x=10;
        int y=100;
        static void doStuff()
        {

                class Inner2{
                        int a=1111;
                        public Inner2 doInnerStuff()
                        {
                                System.out.println(x);
                                return this; // this is possible
                        }
                }
                Inner2 in=new Inner2();
                in.doInnerStuff();
                //return this.x; // can not use 'this in static method
        }
}

why this keyword is not possible in static method whereas it is
possible in class inside that static method?

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en

Reply via email to