Question 1 of 10
A stage dims a torch through a parameter. What text does this Java code display?
public class Torch {
private int flame;
public Torch(int n) {
flame = n;
}
public void lower(int n) {
flame -= n;
}
public int getFlame() {
return flame;
}
}
public class Stage {
public void hush(Torch t) {
t.lower(6);
}
}
Torch post = new Torch(18);
Stage s = new Stage();
s.hush(post);
System.out.print(post.getFlame());
- A. 18
- B. 12
- C. 6
- D. 0