Tag Info

New answers tagged


One multi-lingual/multi-platform programmer's thoughts ... Are the methods in question in the same class as main? If so, they can manipulate the values regardless of the declared access (public/private....). So I assume your question refers to methods which are defined in some other classes. The performance impact of the various options will be irrelevant ...


In this case, I would have to say create an object that holds them - like a "Data" class, which you can then instantiate. This provides a nice single point of access to the data. But, in this case, it does take up some extra space on the heap. (I'm not sure how concerned you should be with this though, java has automatic garbage collection) Another ...

Top 50 recent answers are included