Meaningless Drivel is fun!*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes How come?(Static Doubt) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "How come?(Static Doubt)" Watch "How come?(Static Doubt)" New topic

How come?(Static Doubt)

Amit Batra
Ranch Hand

Joined: Mar 04, 2006
Posts: 361
How come if I have a static method doStuff() in class A that I want to call. then either I must have my own(calling) method as static or make an instance of my class and then call it ex: new A().doStuff(). BUT if I subclass that class say B extends A , then I get to call the static method of class A without even having to have the calling method in class B as static or make an obj of class A. STRANGE!!! Can anyone shed some light on this? All this time I thought statics could only be called from statics.
Amit Batra
Ranch Hand

Joined: Mar 04, 2006
Posts: 361
I get it. I had my concept flipped.
jQuery in Action, 2nd edition
subject: How come?(Static Doubt)
Similar Threads
varargs overloaded method
Naming Confliction
abstract class and static methods
Advanced Overloading (widening,boxing,var args)
Overloading wih static methods