File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes java.util  ,Urgent! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "java.util  ,Urgent! " Watch "java.util  ,Urgent! " New topic

java.util ,Urgent!

kevin goon
Ranch Hand

Joined: Jun 12, 2001
Posts: 62 are described?
a)The elements in the collection are ordered
b)The collection is guaranteed to be immutable.
c)The elements in the collection are guaranteed to be unique.
d)The elements in the collection are accessed using a unique key
e)The elements in the collection are guaranteed to be synchronized

Q2) Which descrive HashSet ?
1) elements stored are unique?
2) have unique keys?

Q3) below compiles(with no further change)
char c = '\ucafe';

thanks!!! X100
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Kevin,
I don't really think this stuff is URGENT!!!
3. a - correct --> lists are always ordered
b - wrong --> can be changed any time
c - wrong --> can be any objects
d - wrong --> only Maps are accessed with unique keys
e - wrong --> According to API

Note that this implementation is not synchronized. If multiple threads access an ArrayList instance concurrently, and at least one of the
threads modifies the list structurally, it must be synchronized externally. (A structural modification is any operation that adds or deletes one
or more elements, or explicitly resizes the backing array; merely setting the value of an element is not a structural modification.)

Q2. 1 - correct --> set always has unique values
2 - wrong --> Only maps have keys
Q3. Because it is a valid unicode character.
Elizabeth Jacob

Joined: Feb 19, 2001
Posts: 28
Hi Kevein,
Ans 1.
a) is true since ArrayList implements List interface.
b) is false since ArrayList can increase or decrease in size.
c) is false since duplicate is allowed.
d) is false since keys and values are for Maps.
e) is false( i think).
Ans 2.
HashSet implements Set interface and does'nt allow duplicates. 2) is false as keys are for Maps.
I agree. Here's the link:
subject: java.util ,Urgent!
It's not a secret anymore!