Adjectives for "variable" - automatic/local/member/method/method level/instance/class
Joined: Sep 29, 1999
I have a variety of different Java materials and books in which variables are described with completely different adjectives. I just wish there was a concensus. Which of these words mean the same exact thing, and what specifically do they mean? "automatic" variable "local" variable "member" variable "method" variable "method level" variable "instance" variable "class" variable Question 1: If I wanted words to describe variables that are in a class body but outside of methods or constructors, wich of the above adjectives would I use? Question 2: If I wanted words to describe variables that are in a method body within a class, which of the above adjectives would I use? Question 3: If I wanted words to describe variables that are in a class within another class, which of the above adjectives would I use? Question 4: Is there another category that I didn't mention in Question 1 - Question 3 above?
Joined: Oct 17, 1999
Hi, Ans(1) : Variables that are declared inside the class are called member variables. A member variable could either be class variable (if it is declared as static) or an instance variable (if it is not declared as static). Ans(2): Variables that are declared inside a block or for loop are called local variables. (in c, we used to call this automatic variable) I don't know which book you are referring to when you say method level variable. As for as words are concerned the authenticated book, i belive is The Java Language Specification by James Gosling Bill Joy Guy Steele. Good luck, Saravanan ------------------