Hi, As you know inner class can access the instance variables of the outer class. There are two ways to access a instance variable from within a inner class. First: if (Test4.this.flag) Second: if (flag)
Second method access flag directly because inner classes can access the outer class instance members, Here inner classes implicit access to the this object of outer class, this is because inner class instance cannot exists wihtout an outer class instance, so when an inner class is instantiated compiler will implicitly pass the outer class instance to it which was used to create the inner class instance. Second is preffered way to do so.
First one is also legal here you explicitly say this object of class Test4. Thanks Deepak
SCJP, SCWCD, SCBCD
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com