Originally posted by blingo james:
Hello
Migrated from C++ to Java,
Working with Eclipse,
Why is it that to use some methods I use
someObject.method()
The method belongs to some other Object (instance of a class), and you need to call the method that works on/from that object.
Originally posted by blingo james:
but sometimes I need to use
someObject.this.method()
More appropriately that should be:
SomeType.this.method()
In these cases, code is executing in an instance of an inner class - a class that only lives as part of an instance of the outer class. The inner class has access to the outer class' methods, but you have to tell it that the method you want to call belongs to the outer class' object, and that is what SomeType.this does - basically 'call method() on my reference to the Object of SomeType that I belong to'.