• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

A question from Sybex virtual tests

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A question from Sybex Virtual Tests :
Select all the classes that provide syncronization via all their methods :
A. Vector
B. Hashtable
C. TreeMap
D. LinkedList
I don't understand the "via all their methods" part
Just tell you opinion about the correct ones.
 
Ranch Hand
Posts: 1246
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Salamina Daniel:
A question from Sybex Virtual Tests :
Select all the classes that provide syncronization via all their methods :
A. Vector
B. Hashtable
C. TreeMap
D. LinkedList
I don't understand the "via all their methods" part
Just tell you opinion about the correct ones.


syncronization methods of the thread-safe class?
answer: a and b
Maybe the answer is just A. let me look at up when i get back to my house.
[ January 08, 2002: Message edited by: FEI NG ]
 
Salamina Daniel
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Answer given:
TreeMap
LinkedList
Explanation given:
The Vector and Hashtable classes were created before the Collection API was developed. Originally these Collection classes were designed to provide syncronization to avoid data corruption. Later versions of the JDK developed the Collections API to provide the developer with classes that allow them to provide their own thread safety.
I don't know what to think ! (I don't get the significance of the "via all their methods" part of the question)
Perhaps there is an error of the test engine .
[ January 08, 2002: Message edited by: Salamina Daniel ]
 
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The answer is most definately a & b. If you look at the source code for Vector and Hashtable you will see that all the non-atomic public API methods are synchronized (gotta love open source!!!).
NONE of the API methods in TreeMap or LinkedList are synchronized. The answer you say is provided by the Sybex test is backwards and wrong; either that, or the question is mis-stated.
Rob Ross
[ January 08, 2002: Message edited by: Rob Ross ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic