aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes keywords Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "keywords" Watch "keywords" New topic
Author

keywords

samdeep aarzoo
Ranch Hand

Joined: Jun 09, 2005
Posts: 160
keywords: volatile ,transient ,strictfp , native
please help me to understand these keywords

volatile variable
transient field
strictfp method
native method
Philip Heller
author
Ranch Hand

Joined: Oct 24, 2000
Posts: 119
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".
samdeep aarzoo
Ranch Hand

Joined: Jun 09, 2005
Posts: 160
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
Timmy Marks
Ranch Hand

Joined: Dec 01, 2003
Posts: 226
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.
soumya ravindranath
Ranch Hand

Joined: Jan 26, 2001
Posts: 300
Bikash,

if you are new to this concept, going through Object Serialization would be of help (not only for SCJP exam). Just try out the piece of code given in the example for understanding and remembering.

E.g.
Mikalai Zaikin
Ranch Hand

Joined: Jun 04, 2002
Posts: 3231
    
    6
Originally posted by bikash mittal:
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


Howdy !

Develop code that serializes and/or de-serializes objects using the following APIs from java.io: DataInputStream, DataOutputStream, FileInputStream, FileOutputStream, ObjectInputStream, ObjectOutputStream and Serializable.

HTH,
MZ


Free SCDJWS 5.0 Study Guide - SCDJWS 5.0 Quiz (How to get SCDJWS 5.0 Quiz)
Java Platform, Enterprise Edition 6 Web Services Developer Certified Expert Exam Study Guide and Quiz
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: keywords