2
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. This also occurs in Java?
2
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. This also occurs in Java?
1
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.
Browser other questions tagged java ruby
You are not signed in. Login or sign up in order to post.