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 one = "student";
String two = "beer";
String three = "dorm";
int number = 12;
sentence(two, one, number);
sentence(three, two, 125);
sentence(three, one, 250);
sentence(one, two, 4);
}
public static void sentence(String one, String two, int number) {
System.out.println(two + "s in the " + one + " = " + number);
}
}
List below the output produced by this program.
1) sentence(two, one, number);
2) sentence(three, two, 125);
3) sentence(three, one, 250);
4) sentence(one, two, 4);