This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 21 Developer Study Guide: Exam 1Z0-830 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Syncronized & serializable

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its not related to ArrayList. A Vector is synchronized, so only one thread at a time can access or manipulate it or its contents.
 
Are we home yet? Wait, did we forget the tiny ad?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic