Parameter Mystery
Category: Parameter Mystery
Author: Brett Wortzman
Book Chapter: 3.1
Problem: Parameter Mystery
At the bottom of the page, write the output produced by the following program, as it would appear on the console.
public class ParameterMystery {
public static void main(String[] args) {
String she = "seashells";
String he = "she";
String seashells = "seashore";
String rocks = "rocks";
String seashore = "starfish";
String beach = "he";
twister(“she”, seashells, “seashore”);
twister(seashore, she, seashells);
twister(beach, he, “he”);
twister(seashells, “she”, she);
twister(rocks, “by the”, he);
}
public static void twister(String place, String pronoun, String thing) {
System.out.println(pronoun + “ sells ” + thing + “ by the “ + place);
}
}
1) twister(“she”, seashells, “seashore”);
2) twister(seashore, she, seashells);
3) twister(beach, he, “he”);
4) twister(seashells, “she”, she);
5) twister(rocks, “by the”, he);