Here i is a class variable, are we allowed to change value assigned to class varaible ?
This message was edited 1 time. Last update was at by jose chiramal
D. Ogranos
Ranch Hand
Joined: Feb 02, 2009
Posts: 166
posted
0
You can reassign any variable that is not marked "final". Note however that what you have in your example is NOT a class variable (marked with "static"). Class variables only exist once, regardless how many object instances you create. So if one object changes the value, all other instances will see the change. Instance variables (such as your variable "i") on the other hand exist for each object instance, so a change in one instance won't be noted in any other instance.