It's not a secret anymore!*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "static method" Watch "static method" New topic
Author

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é
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

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
Sheriff

Joined: Oct 13, 2005
Posts: 37926
    
  22
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
Greenhorn

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.

Regards,
Anu
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: static method
 
Similar Threads
what did i break? "no main method found"
Static Variable Problem
static string
static / non-static method overriding
Static methods - overriding