Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

static method

 
manas ranjan mandal
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i want to know that can i declare static method inside abstract class?
thanks in advance
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What would prevent you from doing so ? (please consider asking this kind of question to the beginner forum).
 
Campbell Ritchie
Sheriff
Pie
Posts: 50196
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic