Static methods are also known as class methods. A static method in a class can directly access other static members in the class. It cannot access instance members of the class, as there is no object being operated on when a static method is invoked. Note, however, that a static method in a class can always use a reference of the class's type to access its member, regargless of the whether these members are static or not.
How can static method access non static members? Thanks Barkat
I have 2000 publication of Khalid'd book. I'm starting to study for 1.4, please advise me if there is any new publication from KM for 1.4 Do the topics covered in this book except AWT and Swing are enough or do i have to refer more books Thanks.
Well if you have a static method, it can access static members (variables and methods) this we agree on, but what if it wants to access non-static members (instance members)? First instance members don't exist until an instance (object) of this class is created right? So for a static member to access an instance member, an instance of the class itself has to be created. Example:
Got the picture? [ October 14, 2002: Message edited by: Alfred Kemety ]