This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes  abstract 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 " abstract static method" Watch " abstract static method" New topic

abstract static method

siva prakashmahendran

Joined: May 03, 2010
Posts: 12
why can't I define an abstract static method?

abstract class foo {
abstract void bar( ); // <-- this is ok
abstract static void bar2(); //<-- this isn't why?

Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3151

Static methods cannot be overridden. But Abstract methods have to be overridden in the extending class (unless the class is not Abstract) to provide the definition. So static and abstract cannot go together. An useful article:

Mohamed Sanaulla | My Blog
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

No virtual method invocation with static method. So what is the purpose of defining them as abstract?

|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: abstract static method
It's not a secret anymore!