Home > DeveloperSection > Forums > Why can't static methods be abstract in Java
Mikki Halpin
Mikki Halpin

Total Post:23

Points:161
Posted on    July-27-2015 6:52 AM

 Java Java  Abstract Class 
Ratings:


 1 Reply(s)
 484  View(s)
Rate this:
The question is in Java why can't I define an abstract static method? for example
abstract class foo {
    abstract void bar( ); // <-- this is ok
    abstract static void bar2(); //<-- this isn't why?
}


Mayank Tripathi
Mayank Tripathi

Total Post:397

Points:3117
Posted on    July-27-2015 8:38 AM

Since "abstract" means: "Implements no functionality"
and, "static" means: "There is functionality even if you don't have an object instance". 
And that's a logical contradiction.

Don't want to miss updates? Please click the below button!

Follow MindStick