aspose file tools
The moose likes Beginning Java and the fly likes  abstract static method Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark " abstract static method" Watch " abstract static method" New topic
Author

abstract static method

siva prakashmahendran
Greenhorn

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
Bartender

Joined: Sep 08, 2007
Posts: 2926
    
  15

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: http://www.coderanch.com/how-to/java/OverridingVsHiding


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 agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: abstract static method
 
Similar Threads
///abstract///
Modifiers
abstract method
question about abatract
static and abstract methods