Parameter Mystery
Category: Parameter Mystery
Author: Stuart Reges
Book Chapter: 3.1
Problem: Parameter Mystery
Consider the following program.
public class Mystery {
public static void main(String[] args) {
String a = "king";
String b = "two";
String c = "queen";
String two = "five";
sentence(a, b, c);
sentence("b", c, c);
sentence(two, "two", a);
sentence(c, a, b);
sentence(two, "queen", b);
}
public static void sentence(String b, String c, String a) {
System.out.println("a " + c + " and a " + a + " beats a " + b);
}
}
List below the output produced by this program.
1) sentence(a, b, c);
2) sentence("b", c, c);
3) sentence(two, "two", a);
4) sentence(c, a, b);
5) sentence(two, "queen", b);