We already learned what an abstract class is and what an interface is. We will now do a detailed comparison of interfaces and abstract classes, followed by a listing of points in favor of each of them, as this is also a very common interview question in Java.
I have seen many people arguing that static methods are not inherited. That is one misconception many beginning programmers have. According to true object oriented principles, static methods should not have inherited, but with Java a class does inherit all members of parent class including static.
So what is the answer to the question of if static methods are inherited? A simple answer as per Java Language Specification would be "Yes" for classes and "No" for interfaces:
This is a personal technical blog where we share our understanding on various concepts and is neither an official page or documentation for the products described here, nor the official views of the companies we work with.
Keywords used in this website are trademarks of their respective owners. This website is not affiliated with Oracle™ and/or any of the JEE frameworks like Spring™, Struts™, Hibernate™ and JSF™.
All contents and materials are provided freely without any warranty or liability and nothing within the site should be considered as professional advice. In any doubt, please ask, and we will try to help you based on our knowledge. Please let us know if you feel anything is not right here (including any copyright violation) and we will act upon it as fast as we can.