Class variable in Java have the same behavior as in Ruby?

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. Does this also occur in Java?

    
asked by anonymous 27.11.2016 / 02:54

1 answer

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.

    
27.11.2016 / 02:58