Top.Mail.Ru
February 27th, 2009 - Java developers — LiveJournal
? ?

Java developers

February 27th, 2009
Image

10:40 pm - Imagesiliconstitches - Java Beginner

My first experience with java is to create a class that deals with coding a sorting class that will sort any object you give it without declaring it as an object within the "test" file. For the most part I'm just having issues getting it to work "with every comparable object". I know that every class is a subclass of Object so I assumed that by extending Object (which seems useless now that I think about it), it should be able to take any class and be able to sort it however, was not the case.
Another minor issue I was confused about was that if you create a global class to sort, shouldn't the compareTo be able to work only on the item you pass through it? By which you would not have to create a compareTo method within "global sort"?


Code below for reference.Collapse )

Thanks for the advice in advance.
Powered by LiveJournal.com
Image