The moose likes Java in General and the fly likes core java,purpose of volatile and transient Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "core java,purpose of volatile and transient" Watch "core java,purpose of volatile and transient" New topic

core java,purpose of volatile and transient

sudha priya

Joined: Nov 06, 2006
Posts: 3
What is volatile and transient variables and the diffrence between them? an use in the real time?
Thank You.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Not a Servlet question, moving to the Java in General (intermediate) forum.

Ulas Ergin
Ranch Hand

Joined: Oct 10, 2002
Posts: 77
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

Joined: Aug 16, 2005
Posts: 15101

Did you try Google? Searching for "java transient" or "java volatile" will give you a lot of information very quickly.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link:
subject: core java,purpose of volatile and transient
It's not a secret anymore!