OOP Java

static and super keyword
          super.static can't because:

          Overriding depends on having an instance of a class. The point of polymorphism is that you can subclass a class and the objects implementing those subclasses will have different behaviors for the same methods defined in the superclass (and overridden in the subclasses). A static method is not associated with any instance of a class so the concept is not applicable.

There were two considerations driving Java's design that impacted this. One was a concern with performance: there had been a lot of criticism of Smalltalk about it being too slow (garbage collection and polymorphic calls being part of that) and Java's creators were determined to avoid that. Another was the decision that the target audience for Java was C++ developers. Making static methods work the way they do had the benefit of familiarity for C++ programmers and was also very fast, because there's no need to wait until runtime to figure out which method to call
src: http://stackoverflow.com/questions/2223386/why-doesnt-java-allow-overriding-of-static-methods
http://stackoverflow.com/questions/5059051/calling-a-super-method-from-a-static-method


Популярные сообщения из этого блога

ubuntu 12.04 LTS install apache2.4 and php 5.6 and setup vhost

установка nginx + PHP5 + phpDaemon и настройка виртуальных хостов на nginx на Ubuntu 13.10

сказ о том, как я kafka и Spring поднимал и тестил