請(qǐng)問下面代碼加粗的部分為什么會(huì)報(bào)錯(cuò)?
public class test {
public static void main(String[] args) {
System.out.println("請(qǐng)輸入矩形的長(zhǎng)和寬");?
Shape rec=new Rectangle();
rec.perimeter();?
rec.area();?
System.out.println("請(qǐng)輸入圓的半徑");?
Shape cir=new Circle();?
cir.perimeter();
cir.area();?
}
}
2017-08-20
Shape是不是不弗雷#24 你是不是多態(tài)哪里沒有學(xué)好