| Author |
Implementing Comparable With a Generic Type
|
Kaydell Leavitt
Ranch Hand
Joined: Nov 18, 2006
Posts: 682
|
|
I'm trying to learn how to use the Comparable interface for Java 5.0+. In the Java 5.0 API, when I implement the Comparable interface in the code below, I get a warning that says that Comparable is "unchecked". Will somebody explain to me why Comparable has a generic type and how to implement the Comparable interface in Java 5.0 and up.
|
 |
victor kamat
Ranch Hand
Joined: Jan 10, 2007
Posts: 247
|
|
The person class should be written so:
|
 |
Kaydell Leavitt
Ranch Hand
Joined: Nov 18, 2006
Posts: 682
|
|
Thank you Victor. I appreciate the help. I think that my next task would be to implement the following methods: toString() equals() hashCode() And, now I've got that done. [ December 27, 2008: Message edited by: Kaydell Leavitt ]
|
 |
 |
|
|
subject: Implementing Comparable With a Generic Type
|
|
|