→ inxbone: double avg(Apple parm){ reture parm.getPrice()/parm.g03/25 04:30
→ inxbone: etWeight();}03/25 04:30
→ PTTTTTTTT: double avg (Apple a) 就可以傳apple class進去了03/25 07:01
我想問一下,我Apple a(int price,double weight)這種寫法要改成怎樣才能編譯通過?
※ 編輯: meiq699 (180.204.50.172), 03/25/2018 13:49:32
→ smallfox0933: public double avg(int price, double weight) { 03/25 23:25
→ smallfox0933: Apple obj = new Apple(price, weight); 03/25 23:26
→ smallfox0933: return obj.getPrice() / obj.getWeight(); } 03/25 23:26
→ PTTTTTTTT: 直接apple a 後面不用int之類的 03/26 12:09
→ baconcsie: 螢幕截圖都不會...課本都沒買?語法在課本裡 03/28 10:26