• 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

java.util ,Urgent!

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
3.java.util.Arraylist 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';
WHY?

thanks!!! X100
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
Regards,
Manfred.
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
Elizabeth.
 
Whip out those weird instruments of science and probe away! I think it's a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic