Qball522, on 17 Jan, 2010 - 08:50 PM, said:
I would assume that he is in class and they are just trying to demonstrate the use of classes. I am in school for programming now and they have us write classes for some rather simple things that could be easier to do without them. Just to get used to witing and working with classes.
I would make the same assumption. However, unlike many of the Intro teachers, DIC promotes good programming practices. Unless he tells us that he absolutely has to use another class, we'd like to teach him the right thing the first time.
Also, I've included a link to the Comparable interface if you want to read more on it. If you're going to go to the trouble of writing a compareTo()-like method, it is probably better to use the Comparable interface as it will make your life easier when working with many API tools like Arrays.sort(), Collections.sort(), etc that look for objects whose classes implement Comparable. Hope it helps some.
Link: http://java.sun.com/...Comparable.html
Edited b/c the OP replied as I was replying.
@OP: The method I provided should be fairly easy to incorporate into your other class then. Go ahead and try incorporating it.
This post has been edited by macosxnerd101: 17 January 2010 - 06:00 PM

New Topic/Question
Reply






MultiQuote

|