:に沿ってエラーが発生しtheTree.insert(new File("a", 1));ますThe method insert(Comparable) in the type Tree is not applicable for the arguments (File)。
そして、そのようtheTree.insert((Comparable) new File("a", 1));にキャストしようとすると、他のエラーが発生します: E xception in thread "main" java.lang.ClassCastException: File cannot be cast to java.lang.Comparable at TreeApp.main(tree.java:134)。
このオブジェクトを渡すことができないのはなぜですか?
私のオブジェクト:
class FileObject
{
public String name;
public int size;
File(String a, int b)
{
this.name = a;
this.size = b;
}
}