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 john = "skip";
String mary = "george";
String george = "mary";
String fun = "drive";
statement(mary, john, fun);
statement(fun, "george", "work");
statement(george, mary, john);
statement(george, "john", "dance");
}
public static void statement(String mary, String john, String fun) {
System.out.println(john + " likes to " + fun + " with " + mary);
}
}
List below the output produced by this program.
1) statement(mary, john, fun);
2) statement(fun, "george", "work");
3) statement(george, mary, john);
4) statement(george, "john", "dance");