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 farm = "here"; String old = "macdonald"; String macdonald = "there"; String everywhere = "farm"; String here = "everywhere"; String there = "old"; String quack = "duck"; mystery(macdonald, there, "everywhere"); mystery(old, macdonald, farm); mystery("quack", here, "there"); mystery(quack, "here", "farm"); mystery(old, everywhere, there); } public static void mystery(String macdonald, String farm, String old) { System.out.println(old + " " + macdonald + " had a " + farm); } }
1) mystery(macdonald, there, "everywhere");
2) mystery(old, macdonald, farm);
3) mystery("quack", here, "there");
4) mystery(quack, "here", "farm");
5) mystery(old, everywhere, there);