• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Comparator as argument?

 
Sandeep Chhabra
Ranch Hand
Posts: 340
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can anyone please answer :
Which of the following may take a Comparato as argument to control softing order?

A Collections.sort() method
B Collection.sort() method
C The TreeSet constructor
D Arrays.sort() method

I think the answer is A, C and D.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sandeep Chhabra:
... Can anyone please answer...

http://java.sun.com/j2se/1.4.2/docs/api/
 
Sandeep Chhabra
Ranch Hand
Posts: 340
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply marc
But I have already referred to the API. and I found that
Collections.sort() method
TreeSet Constructor
Arrays.sort() method

all of them can take the comparator.

But this question is from whizlabs. and It doesnt agree's with me
According to them Arrays.sort cannot take comparator as an argument.
This is the reason that I wanted to confirm.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sandeep Chhabra:
...this question is from whizlabs. and It doesnt agree's with me
According to them Arrays.sort cannot take comparator as an argument.
This is the reason that I wanted to confirm.

Oh, I see. Whizlabs is wrong...
 
Sandeep Chhabra
Ranch Hand
Posts: 340
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Marc
 
Sara Olsen
Ranch Hand
Posts: 59
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sandy,

Did you find many bugs in Whizlabs?
Thinking of bying it...
 
Sandeep Chhabra
Ranch Hand
Posts: 340
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sara Olsen:
Sandy,

Did you find many bugs in Whizlabs?
Thinking of bying it...


Wait for a day more Sara, Dont be in a hurry.
Tomorrow I am going to post A REAL LOOOOOOOOOOOOOOOOOOOOOOONGGGGGGGGG LIST of bugs in whizlabs simulator...
I was shocked to find so many bugs.
 
Jesus Angeles
Ranch Hand
Posts: 2068
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it helps to try out at least one simulation software, to get a feel of the exam. i think there some free ones, so i didnt need to buy any. and also, scjp is an exam with the most free mock exams on the web. you will have more than enough without buying any.
 
Sara Olsen
Ranch Hand
Posts: 59
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jesus Angeles:
scjp is an exam with the most free mock exams on the web. you will have more than enough without buying any.


There are NOT many mock exams for SCJP 5! I know there are lots for 1.4 version, but they are not enough for this one
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's worth noting that this Arrays.sort method is NOT new with Java 5.0. If it were, then we might conclude that the mock exam is specific to 1.4. But in this case, it appears to be a genuine error.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic