阿摩線上測驗 登入

申論題資訊

試卷:104年 - SCJP 1-50#41416
科目:OJCP(SCJP)
年份:104年
排序:0

申論題內容

第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

詳解 (共 4 筆)

詳解 提供者:R GT
22222222222222222222222222222222222222222222222222
詳解 提供者:lovefutiger
NICE
詳解 提供者:朱耕誼
詳解 提供者:egg734631

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 }