Java-->Global Variables--> ???

Started by
11 comments, last by brunogmd 19 years, 10 months ago
While you are explaining this, i have a question. What does transient mean? And I''m also not quite sure about protected.
Thanks..
Advertisement
Variables marked as transient are not saved when serialising a class, so are usually volatile or calculated from the other data (such as the length of a list).

Protected vars are only accessible to the owning class and any inherited classes.
99 times out of 100, when you think you "need" global access to a single variable, you should re-think your design methodology, not try to force it to happen.

The best advice for global OBJECTS would be to use Singletons.

---------------------------Hello, and Welcome to some arbitrary temporal location in the space-time continuum.

This topic is closed to new replies.

Advertisement