Use of transient,strictfp,volatile,native and transient


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Use of transient,strictfp,volatile,native and transient

  1. #1
    Join Date
    Apr 2006
    Posts
    16

    Use of transient,strictfp,volatile,native and transient

    Dear all,

    Please let me know what is the use of transient,strictfp,volatile,native and transient.
    in which situation these keywords being used ???

    please help me because m preparing for SCJP

    Regards
    Rahul Vyas

  2. #2
    Join Date
    Feb 2006
    Location
    Cologne - Germany
    Posts
    271
    native is for methods not defined in java, but defined through a processor dependent dll. if you look at the sourcecodes of the IO-Classes in the java api, you'll see that several methods are defined as native, since they have to call the underlying system's dll's to do io operation.

    transient is for attributes. it defines, in the case, that a class is serializable, that the transient attributes shall not be serialized.
    so when you have a class:
    class a implements serializable{
    int a;
    int b;
    transient int sum;
    }
    and you serialize it, then the file will contain only the values for a and b, not for sum.

    volatile is for variables of basic types, like int, byte, boolean or float. it defines, that an operation on that variable has to be atomar. it's a kind of synchronized for basic types and is applied on multithreaded applications.

  3. #3
    Join Date
    Apr 2006
    Posts
    16

    Thanks

    Thank you for your kind reply

    Regards
    Rahul Vyas

Similar Threads

  1. About transient
    By Raja in forum Java
    Replies: 1
    Last Post: 10-07-2000, 03:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center