| Author |
Comparable Interface
|
rahulJ james
Ranch Hand
Joined: Oct 03, 2008
Posts: 123
|
|
I am writing a program to get the numbers from the user and get that sorted based on ODD or EVEN numbers. I am using a list to store the numbers from user and I could sort it. Can I do the same by using Comparable Interface. If Yes, can someone helo in this..
|
 |
Sridhar Santhanakrishnan
Ranch Hand
Joined: Mar 20, 2007
Posts: 317
|
|
|
Check out Collections.sort()
|
 |
rahulJ james
Ranch Hand
Joined: Oct 03, 2008
Posts: 123
|
|
|
This doesnt give me a proper order.. Again it sorts by its own way..
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
Really? Because if I use your code and then print out the two arrays, I get two sorted arrays - with leading zeros for all non-set elements of course.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: Comparable Interface
|
|
|