This week's book giveaway is in the Design and Architecture forum.
We're giving away four copies of Communication Patterns: A Guide for Developers and Architects and have Jacqui Read 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

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.
 
get schwifty. tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic