abstract class foo {
abstract void bar( ); // <-- this is ok
abstract static void bar2(); //<-- this isn't why?
}
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?
}
why can't I define an abstract static method?
Nope. static methods are class specific. I.E. They apply to that class and that class only. If a subclass then declares a static method of the same name and parameters as its super class it then "hides" the method from the super class (when accessed through the subclass), but does not override it since the super classes method applies only to the super class and the subclasses method applies only to the subclass.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.