In java what is the difference between class variable and instance variable?
-
-
Answer:
The main difference between the class variable and Instance variable is, first time, when class is loaded in to memory, then only memory is allocated for all class variables. Usually static variables are called class variables. These variables are available throughout the execution of the application and the values are common to the class. You can access them directly without creating an object of the class. Instance variables are normal variables declared in a class, that would get initialized when you create an instance of the class. Every instance of the class would have a copy of the variable and you need a class instance (object) to access these variables
wiki.answers.com Visit the source
Related Q & A:
- What is the difference between a static method and class method in Python?Best solution by pythoncentral.io
- What's the difference between Current (I) and Potential Difference (V?Best solution by diffen.com
- What is a typical college class like? How different is it from High School?Best solution by campusexplorer.com
- What does it mean to be unresponsive? What's the difference between unresponsive and unconscious?Best solution by answers.yahoo.com
- What is the difference between a sociological concept and a variable?Best solution by wiki.answers.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.