JavaCompiler not compiling files properly

断了今生、忘了曾经 提交于 2019-12-04 17:16:48

Most likely, this has nothing to do with the compiler. My guess is that this is because of an error in the source file. Did you remember to import the appropriate classes and interfaces?

Your IntegerComparator.java file needs to contain the import:

import java.util.Comparator; // <--- Import!

public class IntegerComparator 
      implements Comparator<Integer>{

   public IntegerComparator(){}

   public int compare(Integer a, Integer b){
      int aValue = a.intValue();
      int bValue = b.intValue();
      return (aValue - bValue);
   }
}

Forgetting to import appropriate classes often results in the "cannot find symbol" error messages.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!