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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

為何在myeclipse執(zhí)行后最后一行多出一堆數(shù)字呢?

父類(lèi)Shape
package?com.imooc;

public?abstract?class?Shape?{
????public?abstract?void?perimeter(int?length);
????public?abstract?void?area(int?length);
}
子類(lèi)
package?com.imooc;
public?class?Rectangle?extends?Shape?{
????
????@Override
????public?void?perimeter(int?length)?{
????????//?TODO?Auto-generated?method?stub
????????System.out.println("矩形周長(zhǎng)為"+length*4);
????}
????@Override
????public?void?area(int?length)?{
????????//?TODO?Auto-generated?method?stub
????????System.out.println("矩形面積為"+length*length);
????}
}
子類(lèi)
package?com.imooc;
public?class?Circle?extends?Shape?{
????
????@Override
????public?void?perimeter(int?length)?{
????????//?TODO?Auto-generated?method?stub
????????System.out.println("圓形周長(zhǎng)為"+2*3.14*length);
????}
????@Override
????public?void?area(int?length)?{
????????//?TODO?Auto-generated?method?stub
????????System.out.println("圓形面積為"+3.14*length*length);
????}
}
package?com.imooc;
public?class?Initial?{
????public?static?void?main(String[]?args)?{
????????Shape?s1?=?new?Rectangle();
????????Shape?s2?=?new?Circle();
????????int?length?=?10;
????????s1.perimeter(length);
????????s1.area(length);
????????s2.perimeter(length);
????????s2.area(length);
????}
}
執(zhí)行結(jié)果:
矩形周長(zhǎng)為40
矩形面積為100
圓形周長(zhǎng)為62.800000000000004
圓形面積為314.0


正在回答

1 回答

那是因?yàn)镴ava輸出的時(shí)候自動(dòng)轉(zhuǎn)換成了double

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

camdy 提問(wèn)者

那末尾的4是哪里來(lái)
2017-05-06 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

為何在myeclipse執(zhí)行后最后一行多出一堆數(shù)字呢?

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

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

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

公眾號(hào)

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