发送了n个错误,不知道这句话Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method addFactorial() is undefined for the type AppMain
at AppMain.main(AppMain.java:5)
,应该怎么解决,
以下是我的含错误的代码
class NoValueException extends RuntimeException
interface Shape //加上了Runtime
{
void getArea();
}
class Rec implements Shape
{
private int len , wid;
Rec(int len ,int wid)//throws NoValueException
{
if(len<=0 || wid<=0)
throw new NoValueException("出现非法值");
else
{
this.len = len;
this.wid = wid;
}
public void getArea{}
{
System.out.println(len*wid);
}
}
class Circle implements Shape
{
private int radius;
public static final double PI = 3.14;
Circle(int radius)
{
if (radius<=0)
throw new RuntimeException("非法")
this.radius = radius;
}
public void getArea()
{
System.out.println(radius*radius*PI);
}
}
class ExceptionTest1
{
public static void main(String[] args)
{
Rec r = new Rec(3,4);
r.getArea();
Circle c = new Circle(-8);
System.out.println(e.toString());
}
System.out.println("over");
cathc(*)
}
}
|
|