`

Interview material collection

    博客分类:
  • Java
 
阅读更多

1. Why can't static methods be abstract in Java?

 

Because "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.
You can't override a static method, so making it abstract would be meaningless. Moreover, a static method in an abstract class would belong to that class, and not the overriding class, so couldn't be used anyway.

 

 

(To be continued)

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics