In Ruby a class variable that is modified by an object ends up modifying the value of all other objects instead of making a copy of that value. Does this also occur in Java?
In Ruby a class variable that is modified by an object ends up modifying the value of all other objects instead of making a copy of that value. Does this also occur in Java?
In Java, class variables are declared with static
. In this case, the object to which this variable refers, will be the same for all instances of the class. Effectively, variables declared with static
in Java are global.