-
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
-
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.
-
Thanks
Thank you for your kind reply
Regards
Rahul Vyas
Similar Threads
-
Replies: 1
Last Post: 10-07-2000, 02: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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks