• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

keywords

 
rani bedi
Ranch Hand
Posts: 358
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can someone throw some light on the following keywords.
synchronized
serializable
native
 
Val Dra
Ranch Hand
Posts: 439
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sandeep Jain
Ranch Hand
Posts: 124
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic