第36題 Given: public class Doubler{ public static int doubleMe(Holder h){ return h.getAmount() * 2; } } and: public class Holder { int amount = 10; public void doubleAmount(){amount = Doubler.doubleMe(this);} public in getAmount(){return amount;} //more code here } Place the code framgmets in position to reduce the coupling between Doubler and Holder. public class Doubler{ public static int doubleMe( Place here h){ return Place here * 2; } } public class Holder { int amount = 10; public void doubleAmount(){amount = Doubler.doubleMe( Place here );} SCJP 6.0 認證教戰手冊 黃彬華著 碁峰出版 19 public in getAmount(){return amount;} //more code here } Code Fragments void Holder int Doubler h.getAmount() h this amount

詳解 (共 9 筆)

【站僕】摩檸Morning.
【站僕】摩檸Morning.
詳解 #1735152
2016/02/02
public class Doubler...
(共 243 字,隱藏中)
前往觀看
陳若凡
陳若凡
詳解 #5054138
2021/08/31


(共 1 字,隱藏中)
前往觀看
何承諺
何承諺
詳解 #4325167
2020/10/18
fff
(共 5 字,隱藏中)
前往觀看
henrywng20012001
henrywng20012001
詳解 #4192574
2020/08/01
no
(共 4 字,隱藏中)
前往觀看
R GT
R GT
詳解 #2386028
2017/08/18
22222222222222222222222222222222222222222222222222
henrywng20012001
henrywng20012001
詳解 #4186732
2020/07/30
x
(共 3 字,隱藏中)
前往觀看
lovefutiger
lovefutiger
詳解 #2820290
2018/05/29
NICE
朱耕誼
朱耕誼
詳解 #2818030
2018/05/28
egg734631
egg734631
詳解 #2426361
2017/09/30

Given: public class Doubler{ public static int doubleMe(Holder h){ return h.getAmount() * 2; } } and: public class Holder { int amount = 10; public void doubleAmount(){ amount = Doubler.doubleMe(this); } public int getAmount(){ return amount; } //more code here } ---------------------------------------------------------------------------------------------------- Place the code framgmets in position to reduce the coupling between Doubler and Holder. public class Doubler{ public static int doubleMe( Holder h){ return h.getAmount() * 2; } } public class Holder { int amount = 10; public void doubleAmount(){ amount = Doubler.doubleMe(this); } public int getAmount(){ return amount; } //more code here }