hi plz give the difference between c++ and Java and also difference between Instance variable and class variable
posted 15 years ago
This is a link to an article listing the comparison of Java to C++ http://java.sun.com/docs/white/langenv/Simple.doc1.html An instance variable is a variable that exists in each occurance or instance (object) of the class that is created. This is how you keep track of the attributes of each instance separately from the other instances. When you say class variable I believe that you are referencing static variables. When the class is first loaded (before any instances are created) the static variable(s) is created. A static variable only exists once for all instances of the class. An example is the static variable pi in the math class. There is only 1 pi, and all the instances use it. In addition there are local variables. These exist only inside methods and when the method invocation is over they cease to exist.
"JavaRanch, where the deer and the Certified play" - David O'Meara