编译器说“找不到符号:方法 compareTo(java.lang.Object)”。你能建议这里的错误在哪里吗?
这是代码的一部分:
public class OBTComparable<ObjectType> implements Comparable<OBTComparable>
{
public OTBComparable leftNode = null;
public OBTComparable mainNode = null;
public OBTComparable rightNode = null;
public ObjectType object = null;
public OBTComparable(ObjectType requiredObject)
{
object = requiredObject;
}
@Override
public int compareTo(OBTComparable other)
{
if(object.compareTo(other.object) == 0)
return 0;
else
if (object.compareTo(other.object) > 0)
return 1;
else return -1;
}
}