This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Originally posted by Ameen khan: Class variables = instance variables + static variables
When you create different instances of a class, each instance will have it's own copy of the (instance) variables defined in the class. Modifying an instance variable of one class won't affect the instance variable of another class. When you define a variable as static, it becomes a class variable. In this case only one copy of the variable is made and all the instances will share this single copy. If you make a change to this variable, it will reflect everywhere (i.e. in all instances).