Meaningless Drivel is fun!
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
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: 45365
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.

I agree. Here's the link:
subject: static method
It's not a secret anymore!