*
The moose likes Beginning Java and the fly likes keywords Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "keywords" Watch "keywords" New topic
Author

keywords

rani bedi
Ranch Hand

Joined: Feb 06, 2001
Posts: 358
can someone throw some light on the following keywords.
synchronized
serializable
native


Cheers,<br />Rani<br />SCJP, SCWCD, SCBCD
Val Dra
Ranch Hand

Joined: Jan 26, 2001
Posts: 439
Originally posted by parmeet bedi:
can someone throw some light on the following keywords.
synchronized
serializable
native

Hello , synchronized keyword is used to control access to a particual method or block when more then one thread is trying to access that method or synchronized block.
serializable is an interface which is implemented by your class in order to pass data over network or save it to a disk and later restore that object with it's defined values.
native is used to indicate that you want to be dealing with functionality of another language like c/c++ calling it's functions.

Val SCJP <BR>going for SCJD
Sandeep Jain
Ranch Hand

Joined: Oct 25, 2000
Posts: 124
Hello ,
**************
synchronized
**************
This keyword is used to avoid multiple threads able to access a function or a particular peice of code .Say for eg
Imagine a case u and ur brother are the joint account holders ,And accidently u and ur brother go a the same time to bank while u are depositing the amount say for eg 1000 urbrother is withdrawing the amount 2000 . If both the request are simaltanous made then the teller wont know what to do whether to add 1000 or to remove
2000 from the balance . So if syncronized keyword is used only person(thread) is allowed to enter into the transaction....
**************
Serializable
**************
Serialzble is the keyword which is used basically for storing the objects state . it need not be just string , it can be any object
U dont have to bother about how it will store the state . All u need to do is implemnt the serializable interface
**********
Native
**********
Native methods are used to give a call to the programs writen in some other language .now say for eq u have written some code in c or c++ or some language , and u want to make use of the same code in that case u can make a native call from java to that particular
method.

------------------
Try and Try Till u succeed
Sandeep Jain


Try and Try Till u succeed<br /> <br />Sandeep Jain
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: keywords
 
Similar Threads
Key Words
about keywords
java keywords
keywords
r they keywords or literals?