abstract class foo {
abstract void bar(); // <-- Pig
abstract static void bar2(); //<-- No
}
Why can't you define a static method for an abstract class like above?
java abstract-class static-methods
The rule of 'abstract' is no implementation of the method.
The abstract class itself cannot be objectified, so implementation is not necessary.
In the static method, a function can be called without the class being objectified, but grammatically, an error is bound to occur.
© 2024 OneMinuteCode. All rights reserved.