Fortunately, the only one of these that you need to know for the SCJP exam is transient.
A transient field is not serialized when, for example, an object is written to an ObjectOutputStream via the writeObject() method. Much much more on this in Chapter 9 of the 5.0 rev of "Complete Java Certification StudyGuide".
A volatile field has subtly different behavior from a non-volatile field in a multi-threaded environment. The exact behavior is WAY beyond our scope here.
The strictfp keyword takes care of an embarrassing situation. In certain really extreme numeric operation situations, the JVM produces results that aren't exactly what the IEEE floating point spec calls for. A strictfp method uses the "strict" IEEE algorithms, and always generates IEEE-compliant results. Similarly, when a strictfp variable appears as an operand in a floatinf-point operation, the IEEE algorithm is used.
A native method looks like an abstract method. After the declaration, where you would expect to see a method body, there's just a semicolon. A call to the method is delegated to a dynamic library on the local machine. As you'd expect, there's a certain amount of work that you need to do to glue the Java code to the native library. Native methods are how a Java program can interact with the mouse, keyboard, and other hardware resources of the underlying hardware.
Consultant to SCJP team.<br />Co-designer of SCJD exam.<br />Co-author of "Complete Java 2 Certification Study Guide".<br />Author of "Ground-Up Java".
Joined: Jun 09, 2005
please explain transient field
what is transient field what is meant by this statement Prevent field from ever being serialized. transient fields are skipped , when objects are serialized
When you "serialize" an Object instance, you prepare it to be written to a stream (whether its final destination is a file, another computer in the network, or whatever). When you declare a field to be transient, you are saying to the runtime, when this Object is sent to the stream, leave out the value of this field.
You may do this for security (if you don't want to write sensitive information) or to reduce size (for instance, large data structures which can be recalculated).
An example for the second reason, let's say you have a 1024x768 image in a jpg file. When you run your program, it loads this image from the jpg file anyway, so you would want your Image object to be transient, because when you load the serialized data, you can just load the Image from the file again.