logo Practice-It logo

parameter mystery

Author: Whitaker Brand (on 2010/12/28)

Given the following program:

public class ParameterMystery {
    public static void main(String[] args) {
        String x = "happy";
        String y = "pumpkin";
        String z = "orange";
        String pumpkin = "sleepy";
        String orange = "vampire";
      
        orange(y, x, z);            // #1
        orange(x, z, y);            // #2
        orange(pumpkin, z, "y");    // #3
        
        z = "green";
        orange("x", "pumpkin", z);  // #4

        orange(y, z, orange);       // #5
    }

    public static void orange(String z, String y, String x) {
        System.out.println(y + " and " + z + " were " + x);
    }
}

Write the output corresponding to the numbered method calls, as it would appear on the console.

#1
#2
#3
#4
#5

You must log in before you can solve this problem.


Log In

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.