This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes static method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "static method" Watch "static method" New topic

static method

manas ranjan mandal
Ranch Hand

Joined: Apr 02, 2008
Posts: 97
hi i want to know that can i declare static method inside abstract class?
thanks in advance
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

What would prevent you from doing so ? (please consider asking this kind of question to the beginner forum).

[My Blog]
All roads lead to JavaRanch
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 44524
I agree with Christopher this sounds like a beginner's question.

You implement a static method exactly the same way in any class; remember you can't override static methods; look at this FAQ, and ask again if there's anything you don't understand.
anu kuntala

Joined: Sep 25, 2008
Posts: 17
Hi Manas,
Yes we can declare static methods in Abstract classes. You won't get any compiler error. But you cannot declare a method as both abstract and static. Because static methods cannot be overriden.

Consider Paul's rocket mass heater.
subject: static method
It's not a secret anymore!