Hi All, I hava a question...Help me..
Hi All!
我有一个问题,我要按照一个class的API写这个class,这个class
Implemented Interfaces:
java.lang.Comparable
其中有一个method是这样的:
public int compareTo(java.lang.Object other)
Compares this object with the specified object for order. Returns a negative, zero, or positive integer based on whether this object is less than, equal to, or greater than the specified object.
Specified by:
compareTo in interface java.lang.Comparable
Parameters:
other - the Object to compare to.
Returns:
the same return as that of compareTo(String) in String when invoked on the title of this book.
这个method应该怎么写的?我的问题在于不太明白如何在这个class里使用这个interface。我感觉好像是在这个method里使用Interface java.lang.Comparable 来compare两个string
请详细指点,谢谢。 简单说,就是我还不太明白interface是怎么回事,还有如何使用。
我的QQ 314386
MSN rayoko-com@hotmail.com