Object Oriented Programming (OOPs)

© examsiri.com
Question : 52 of 72
 
Marks: +1, -0
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 void getAmount(){ return amount; }
  // more Code
}

Place the code fragments in position to reduce teh 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]);
 }
 public int getAmount(){return amount;};
 /*more code*/}
Go to Question: