home [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members] Member Listing  [Register] Register 

Username:   Password:  

What is the difference between Transient, Volatile and Strictfp?  XML
Forum Index » Общие вопросы
Author Message
n0mer

Офигенно Вдохновлённая Белка
[Avatar]

Joined: 14/05/2005 15:16:57
Messages: 3567
Offline

http://java.ittoolbox.com/documents/popular-q-and-a/transient-volatile-and-strictfp-3714
transient: The transient modifier applies to variables only and it is not
stored as part of its object's Persistent state. These variables are not
serialized. Transient instance fields are neither saved nor restored by the
standard serialization . You have to handle restoring them yourself.

volatile: Volatile modifier tells the compiler that the variable modified by
volatile can be changed unexpectedly by other parts of the program. For
example a Variable might be read from Cache and not update the content if it
has been changed by another thread. Specifying a variable as volatile tells
the JVM that any threads using that variable are not allowed to cache that
value at all. Making the Variable Volatile will ensure that the compiler
will get the content of the variable every time it is used and not cache its
content. If not used Carefully this modifier might introduce bugs..

strictfp: is used to restrict floating point calculations ( fp ) to ensure
portability ( platform Independent ). When this modifier is specified, the
JVM adheres to the Java specifications ( IEEE-754 floating-point
specification ) and returns the consistent value independent of the
platform. That is, if you want the answers from your code (which uses
floating point values) to be consistent in all platforms, then you need to
specify the strictfp modifier.
[WWW] [ICQ]
n0mer

Офигенно Вдохновлённая Белка
[Avatar]

Joined: 14/05/2005 15:16:57
Messages: 3567
Offline

See also:
* Making Deep Copies of Objects, Using strictfp, and Optimizing String Performance
* Updates to the Java™ Language Specification for JDK™ Release 1.2 Floating Point (PDF)

This message was edited 1 time. Last update was at 23/07/2008 23:36:10

[WWW] [ICQ]
 
Forum Index » Общие вопросы


Go to:   
Powered by JForum 2.1.8 © 2005-2008 - Rafael Steil