package jj;
interface shape{
abstract double computer(double a,double b);
}
class Triangle implements shape{
double S;
public double computer(double a,double b) {
S=a*b/2.0;
return S;
}
class Rectangle implements shape{
public double computer(double a,double b) {
return a*b;
}
}
}
public class Test3 {
public static void main(String[] args) {
Triangle p=new Triangle();
Rectangle p1=new Rectangle();
System.out.println("三角形的面积为"+p.computer(2, 1) );
System.out.println("矩形的面积为"+p1.computer(2,2));
}
}
什么错误?