Test.java:11: cannot access DevideByMinus bad class file: .\DevideByMinus.class class file contains wrong class: org.it315.DevideByMinus.class Please remove or make sure it appears in the correct subdirectory of the classpath.
import org.it315.*; public class Test { public int devide(int x, int y) throws ArithmeticException, DevideByMinusException { if (y<0) throw new DevideByMinusException("devisor is "+y); int result = x/y; return x/y; } } //感觉这段程序好象有问题,没有主方法,这样程序怎么找入口 //是否应该把java.lang.* import进来
bad class file: .\DevideByMinus.class
class file contains wrong class: org.it315.DevideByMinus.class
Please remove or make sure it appears in the correct subdirectory of the classpath.
放在哪个目录下面就怎么声明package
关键是这个Test.java不加package可以吗
我不想加
public class Test
{
public int devide(int x, int y) throws ArithmeticException, DevideByMinusException
{
if (y<0) throw new DevideByMinusException("devisor is "+y);
int result = x/y;
return x/y;
}
}
//感觉这段程序好象有问题,没有主方法,这样程序怎么找入口
//是否应该把java.lang.* import进来
这是为什么啊
Test,DevideByMinusException分别在什么目录下,说清楚一点