This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How come?(Static Doubt)

 
Amit Batra
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 361
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get it. I had my concept flipped.
Sorry!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic