WHY CAN'T STATIC METHODS BE ABSTRACT IN JAVA

Mikki Halpin

Total Post:23

Points:161
Posted by  Mikki Halpin
 890  View(s)
Ratings:
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?
}
  1. Mayank Tripathi

    Post:397

    Points:3117
    Re: Why can't static methods be abstract in Java

    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.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!