• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mock Exam Question

 
Asha Pathik
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,



In the above code the answers are given as " a, d and e". I understood the reson for option a and d but I'm not able to get why option e is correct. Could someone plz explain me that?

Thanks
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is the purpose of the generic declaration TreeSet<test>. You specify that the TreeSet is going to hold test objects.
 
Asha Pathik
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh! ... got it. It was a general question about generics. I was mixing it with program behaviour.

Thanks Keith
Asha
 
Dave Tan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the use of the Comparator interface allowed? As far as i know, only interface Comparable can be used.
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mean in general or with generics?
 
Asha Pathik
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I meant the other options were related to the program behaviour whereas the last option was about the correct meaning of the "generic collection declaration", nothing related to program behaviour.

Asha
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic