Originally posted by Sowmiya girish:
Based the two replies - can we say that compareTo() can be used with or without implementing the comparable. Correct me if i am wrong...
Sure you can, but keep in mind that without saying that your class implements Comparable, you will not be able to pass a class instance to a method expecting a parameter that "is-a" Comparable. For example, the version of Collections.max that takes a Comparable:
Hope that helps!
Author, Spring Security 3 (the Book), Packt Publishing, 2010
SCJP, OCP