• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Adjectives for "variable" - automatic/local/member/method/method level/instance/class

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

Thanks!
 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
------------------

 
Trailboss
Posts: 23888
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Q1: class attribute
Q2: local variable
Q3: class attribute
Q4: Parameters.
 
Look! It's Leonardo da Vinci! And he brought a tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic