Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

core java,purpose of volatile and transient

 
sudha priya
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is volatile and transient variables and the diffrence between them? an use in the real time?
Thank You.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a Servlet question, moving to the Java in General (intermediate) forum.

Dave
 
Ulas Ergin
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
transient: indicates that the member of the class need not be serialized during serializatin process (hence need not be restored during dererialization)

volatile: indicates that the member variable is accessed by multiple threads simultaneously and certain optimizations should not be allied for it.See Java Memory Model for detailed info.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15207
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try Google? Searching for "java transient" or "java volatile" will give you a lot of information very quickly.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic