第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定

我的練習(xí)題

?

package com.imooc;

public abstract class Shape {
?double a;
?double b;
?double r;
?public abstract void l();
?public abstract void s();

}


package com.imooc;

public class Rectangle extends Shape {

?@Override
?public void l() {
??// TODO Auto-generated method stub
??Object l1 = 2*(a+b);
??System.out.println(l1);
?}

?@Override
?public void s() {
??// TODO Auto-generated method stub
??double s = a*b;
??System.out.println(s);
?}

}


package com.imooc;

public class Circle extends Shape {

?final double PI = 3.14;

?@Override
?public void l() {
???// TODO Auto-generated method stub
??Object l = 2*PI *r;
??System.out.println(l);
?}

?@Override
?public void s() {
??// TODO Auto-generated method stub
??double s = PI*r*r;
??System.out.println(s);
?}

}


package com.imooc;

public class Test {

?public static void main(String[] args) {
??// TODO Auto-generated method stub
??Shape shape = new Rectangle();
??shape.a=6.0;
??shape.b=4.0;
??shape.l();
??shape.s();
??
??Shape shape2 = new Circle();
??shape2.r = 4.0;
??shape2.l();
??shape2.s();
??

?}

}

?

正在回答

1 回答

Rectangle just have a and b, and donot have r.

Circle just have r, and donot have a and b.

1 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消
Java入門第二季 升級版
  • 參與學(xué)習(xí)       531100    人
  • 解答問題       6280    個

課程升級!以終為始告別枯燥,在開發(fā)和重構(gòu)中體會Java面向?qū)ο缶幊痰膴W妙

進(jìn)入課程

我的練習(xí)題

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號