• 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

can final variales be manipulated?

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In HFSJ(2nd edition) while discussing thread safty for instance variables they say, "even a final variable can still be manipulated unless it is immutable" (pg. 204) . I didn't get the meaning, please help!!
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What they probably mean is this: If a variable is final, then the value of the variable itself cannot be changed; but if the variable refers to an object, then you can still change the contents of that object (if the object is not immutable).

I'm going to move this to the Java in General (Beginner) forum, since it's not a question specifically about servlets.
 
Yashashree Kale
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jesper Young:
What they probably mean is this: If a variable is final, then the value of the variable itself cannot be changed; but if the variable refers to an object, then you can still change the contents of that object (if the object is not immutable).

I'm going to move this to the Java in General (Beginner) forum, since it's not a question specifically about servlets.

THANKS Jesper

 
reply
    Bookmark Topic Watch Topic
  • New Topic