You are here:

Java/Static and inheritance


do static method and static data takes part in inheritance? if not how it is possible to access static method or data of base class  by derived class object is ok in JAVA, where error in c++.does c++ behave differently with static .plz explain?

No, static methods and data aren't part of inheritance, although you can call static methods without qualifying the class if it is in a subclass. You can access static data in subclasses the same way a any other class access it. I.e. ClassName.method().

This is basically the same way it work as in C++.


All Answers

Answers by Expert:

Ask Experts


Artemus Harper


I have a Masters in computer science. I can answer questions on core J2SE, swing and graphics. Please no questions about JSP or J2ME.


I have experience in Core Java, good background in Java swing/gui, some experience with JNI, Java reflection. Some experience in bio-informatics. Basics in c++ and c#

Washington State University

MS in Computer Science from Washington State University and a BS in Mathematics and Computer Science from Central Washington University.

©2017 All rights reserved.