Parameter Mystery
Category: Parameter Mystery
Author: Benson Limketkai
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 a = "apple"; String p = "lead"; String q = "king"; String r = "people"; String king = "run"; String and = "bear"; String chicken = "pork"; mystery(p, r, q); mystery(q, p, king); mystery(p, king, "chicken"); mystery(q, and, "a"); mystery(r, "and", r); } public static void mystery(String r, String p, String q) { System.out.println(p + " see " + q + " " + r); } }
1) mystery(p, r, q);
2) mystery(q, p, king);
3) mystery(p, king, "chicken");
4) mystery(q, and, "a");
5) mystery(r, "and", r);