Parameter Mystery
Category: Parameter Mystery
Author: Helene Martin and Marty Stepp
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 bril = "vorpal";
String gyre = "jubjub";
String slithy = "snack";
String tum = "mut";
String mut = tum + 1;
mystery(bril, slithy, gyre);
mystery(gyre, "gyre", mut);
mystery(gyre + slithy, bril, tum);
tum = "tumtum";
bril = "slithy";
mystery(tum, gyre, slithy);
}
public static void mystery(String gyre, String bril, String slithy) {
System.out.println("Twas " + bril + " and the " + slithy +
" toves did " + gyre);
}
}
1) mystery(bril, slithy, gyre);
2) mystery(gyre, "gyre", mut);
3) mystery(gyre + slithy, bril, tum);
4) mystery(tum, gyre, slithy);