日期:2014-05-18  浏览次数:20724 次

有关类文件编译的问题!!高手请进!!!!!!
我定义了两个类,其中一个类用到类一个类,这两个类同属于一个包,如下:
package nttontology;
import java.util.Comparator;

public class ByValueComparator implements Comparator {

  public int compare(Object firstVector, Object secondVector) {

  float firstValue = ((Vector) firstVector).getValue();

  float secondValue = ((Vector) secondVector).getValue();

  if ((firstValue - secondValue) > 0)
  return -1;
  if ((firstValue - secondValue) < 0)
  return 1;
  else
  return 0;
  }
}
************
package nttontology;  
public class Vector {
  private int index;
  private float value;
  public Vector(int index, float value) {
  this.index = index;
  this.value = value;
  }
  public int getIndex() {
  return index;
  }
  public void setIndex(int index) {
  this.index = index;
  }
  public float getValue() {
  return value;
  }
  public void setValue(float value) {
  this.value = value;
  }  
}
出现以下错误提示:
C:\Tomcat\webapps\mytest\WEB-INF\classes\nttontology\ByValueComparator.java:8:
annot resolve symbol
symbol : class Vector
location: class nttontology.ByValueComparator
  float firstValue = ((Vector) firstVector).getValue();
  ^
C:\Tomcat\webapps\mytest\WEB-INF\classes\nttontology\ByValueComparator.java:10
cannot resolve symbol
symbol : class Vector
location: class nttontology.ByValueComparator
  float secondValue = ((Vector) secondVector).getValue();
  ^
2 errors
望高手指教!!!!!!!!!!!!!!!!

------解决方案--------------------
到C:\Tomcat\webapps\mytest\WEB-INF\classes\nttontology\目录下查看是否存在自定义的Vector.class类