我看过这段代码,不确定它如何与compareTo一起使用.有人可以指导我如何运作?
public enum Test
{
POTATO("Potato"),
TOMATO("Tomato"),
CARROT("Carrot")
public String Name;
private Test(String name) {
this.Name = name;
}
public boolean testFor(Test t)
{
if (compareTo(t) <= 0) {
return true;
}
return false;
}
}
Run Code Online (Sandbox Code Playgroud)