Parameter Mystery
Category: Parameter Mystery
Author: Alan Borning and Dan Grossman
Book Chapter: 3.1
Problem: Parameter Mystery
What output is produced by the following program? public class ParameterMystery { public static void main(String[] args) { String head = "shoulders"; String knees = "toes"; String elbow = "head"; String eye = "eyes and ears"; String ear = "eye"; touch(ear, elbow); touch(elbow, ear); touch(head, "elbow"); touch(eye, eye); touch(knees, "Toes"); touch(head, "knees " + knees); } public static void touch(String elbow, String ear) { System.out.println("touch your " + elbow + " to your " + ear); } }
1) touch(ear, elbow);
2) touch(elbow, ear);
3) touch(head, "elbow");
4) touch(eye, eye);
5) touch(knees, "Toes");
6) touch(head, "knees " + knees);