This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
hi Varalakshmi firstly static methods can access not-static methods only you have to specify the object on which you want to call them for eg <object_name>.<non-Static_method> which is exactly what you are doing in your program and because you have overridden the superclass method you got the output from subclass
The significant problems we face cannot be solved by the same level of thinking which created them – Einstein SCJP 1.5, SCWCD, SCBCD in the making
A non-static class member (a variable or a method) needs an outer wrapper on which it can be called or accessed. The wrapper is nothing but an instance of the class, an object. Every object has its own set of the non-static members and handles it.
On the contrary, a static method or variable is run by the class itself(not an object). So, to access a static method, you can use either the method name only or the syntax Classname.Method()
I think that clears your doubt...
Joined: Oct 28, 2007
Lots of Thanks to all three of you. I got the point.