jQuery in Action, 2nd edition*
The moose likes Beginning Java and the fly likes Syncronized & serializable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Syncronized & serializable" Watch "Syncronized & serializable" New topic
Author

Syncronized & serializable

Nimish Patel
Ranch Hand

Joined: Jun 29, 2005
Posts: 84
Hi,

I know diffrence between vector and arraylist.
Vector is syncronized and arraylist is not syncronized.

what is the meaning of syncronized related to vector and arraylist ?

and more, when class implement serializable interface, what happen ?
generaly bean class implement serializable interface,
but what is it gain ?

i can't understand.

please help me.

Thanks in anticipation.

with rgds,
Nimish
madhup narain
Ranch Hand

Joined: Dec 14, 2004
Posts: 148
heres what i can say about synchronized

Only one thread at a time can own the lock for any given object. Thus if more than one thread tries to enter a section of code for which the lock must be acquired then only one thread will get the lock and all other threads will block. Note however that a thread can still execute a non-synchronized method or block of code even if the object is locked.


Money for nothing and Java for Free
SCJP, SCWCD
vidhyasagar reddy
Ranch Hand

Joined: Jul 05, 2005
Posts: 40
we are implementing serializable means we making that class object as persistant

class x implemts Serializable
{
....
}


means if u create object for x that object is persistant
Steve Simon Joseph Fernandez
Ranch Hand

Joined: Jul 17, 2005
Posts: 35
Hi,

The serializable interface is a marker interface - implying that it doesn't contain any methods to implement. It tells the JVM that objects of this class are serializable by default - they can be converted to and from a byte stream by the default methods applied by the JVM. Serialization is done to 1) transmit objects via the network and 2)store objects in a persistent store. The opposite of serialization, i.e. deserialization, takes serialized objects and puts them back into the JVM heap.

_steve.
Nimish Patel
Ranch Hand

Joined: Jun 29, 2005
Posts: 84
Thanks for giving ur valuable time,

but i want to know syncronization related to vector and arraylist.

please help me.

rgds,
Nimish Patel
6:40 pm
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Its not related to ArrayList. A Vector is synchronized, so only one thread at a time can access or manipulate it or its contents.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Syncronized & serializable