Hi, I thought the following code would give a compilation error since am accessing the static member of an outer class in the inner class.As per InnerClass definitions it cannot have static declarations of any kind.Is it not applicable to the static members from outer class??Please help me
Originally posted by Ramnath krishnamurthi: I thought the following code would give a compilation error since am accessing the static member of an outer class in the inner class.
There's no such restriction. Remember what 'static' means - members belonging to the class, not instance. For a variable, its value has no bearing on the state of the instance. So in your example, this statement is also valid:
Hi Dave Accessing a static variable is allowed in an inner class but you can not declare a static variable in a non-static inner class. So displaying the value of x, declared outside of the inner class, is fine but declaring a static variable in a non-static inner class is not allowed.
Joined: Jan 22, 2003
Hi Thank you all. btw,Hey Anupam did u ever work in cisco systems??I know a Anupam Sinha who worked with me @ cisco systems??
Joined: Apr 13, 2003
Hi Ramnath Well no. I have till date not worked with Cisco Systems.