A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
OCA Java SE 8 Programmer I Study Guide 1Z0-808
this week in the
manas ranjan mandal
Joined: Apr 02, 2008
Sep 26, 2008 01:58:00
hi i want to know that can i declare static method inside abstract class?
thanks in advance
Joined: Nov 24, 2005
Sep 26, 2008 02:05:00
What would prevent you from doing so ? (please consider asking this kind of question to the
All roads lead to JavaRanch
Joined: Oct 13, 2005
Sep 26, 2008 02:45:00
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
, and ask again if there's anything you don't understand.
Joined: Sep 25, 2008
Sep 26, 2008 03:10:00
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
static / non-static method overriding
Static Variable Problem
Static methods - overriding
what did i break? "no main method found"
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015