抽像方法问题
请问一下,我这个程序怎样改才能正确运行呢,最好能说说理由,谢谢!!import java.lang.Math.*;
abstract class shape{
abstract void area();
}
class rectangle extends shape{
float width,height;
public void retangle(float a,float b){
width=a;height=b;}
public void area(){
System.out.println("Area is "+(width*height));
}
}
class circle extends shape{
float radius;
public void circle(float r){
radius=r;}
public void area(){
System.out.println("Area is "+(radius*radius*Math.PI));
}
}
public class test1{
public static void main(String args[])
{rectangle rect=new rectangle(5,10);
rect.area();
circle cir=new circle(2);
cir.area();
}
}