• 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

Collections(?)

 
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note the () brackets are meant to be squate brackets.
It wouldn't let me post with them

The supertype of all kinds of Collections is:

(a)Collection(Object)
(b)Collection(?)
(c)Collection(Element)

What is the answer?
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't understand the question. A "supertype" is a class. However, the notation in the three choices makes them all look like constructors. Can you please clarify your question?

Layne
 
Kris Reid
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It was an exam question. That's all the info I have sorry.

The answer is B
but I don't see why it Can't be A

Anything could be added to A can't it?
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have no idea what the ? means. This punctuation is not commonly used in Java. In fact, the only place it's possible to use ? is with the ternary operator which means there must also be a :. You don't typically see this used very often. I'm sorry that I don't know how to help since I don't even understand the question, or more importantly I don't understand what the choices mean.

Layne
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oohh...I just had an idea. You said you used parens because you couldn't figure out how to put square brackets (i.e. [ ]) in your post. Should they be a angle brackets (i.e. < >) instead? This might make some sense if you are learning Java 1.5 and generics.

Layne
[ April 21, 2005: Message edited by: Layne Lund ]
 
Kris Reid
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found the answer
The exam is coorect with B

http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf
page 5
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I suspect, the choices are using the new generics from JDK 1.5. This means that they should actualy read as

(a) Collection<Object>
(b) Collection<?>
(c) Collection<Element>

This small change makes a BIG difference. For future reference, when we use the less-than and greater-than characters, they are commonly referred to as angle brackets, not square brackets.

Layne
 
Kris Reid
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
DOE! sorry my bad
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[Kris]: DOE!

A deer! A female deer!



[Kris]: It was an exam question. That's all the info I have sorry.

Ahem. Are you saying this was a question from the real exam? Because, y'know, such things are not to be posted here. Or anywhere, really. Or was this a mock exam?
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jim Yingst:
[Kris]: DOE!

A deer! A female deer!



[Kris]: It was an exam question. That's all the info I have sorry.

Ahem. Are you saying this was a question from the real exam? Because, y'know, such things are not to be posted here. Or anywhere, really. Or was this a mock exam?



Or was it from an exam in a college course?
 
reply
    Bookmark Topic Watch Topic
  • New Topic