• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

What is the difference between instance variables and non local variables

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

the KB book says
Instance variables can be public,private,protected,default,final,transient
They can't be abstract,static,strictfp,synchronized,native

Non local variables can be public,private,protected,default,final,transient,static, volatile

What are non local variables ?
 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't know. Maybe instance fields and static fields.
 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vijay Tyagi wrote:
the KB book says
Instance variables can be public,private,protected,default,final,transient
They can't be abstract,static,strictfp,synchronized,native

Non local variables can be public,private,protected,default,final,transient,static, volatile

What are non local variables ?



It seems to me that non-local variables is the bigger pot that contains both instance variables and non-instance variables -- any variables that are not local to a block -- but of course I could be wrong.
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with the both of you. Which brings up an important omission in the first statement: "Instance variables can be public,private,protected,default,final,transient". They can also be volatile. Static is the only difference between instance variables and non-local variables - because static makes them class variables and no longer instance variables.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic