global variable
All > Technology > Programming > Java
- A phenomenon that is more usually regarded as being a problem in structured programming languages than in object-oriented languages. In a structured programming language, such as Pascal or C, a global variable is one defined outside the procedures and functions of a program. It is difficult to keep track of the usage of such a variable as it is readable and writable by the whole program or module in which it is defined. This makes such variables a common source of logical errors. In fact, instance variables pose a similar problem within class definitions, since Java's scope rules make them accessible to all methods defined within a class. This is one of the reasons why we prefer to channel access to instance variables through accessor and mutator methods even within a class.
David J. Barnes - Cite This Source - This Definition - class, classpath, encapsulation, functional programming, imperative programming, lexicographic ordering, locale, method