logo Practice-It logo

parameter mystery

Author: Roy McElmurry (on 2010/12/28)

What output is produced by the following program?

public class Mystery {
    public static void main(String[] args) {
        String she = "it";
        String it = "her";
        String her = "you";
        String you = "she";

        saying(you, it, you);
        saying(it, her, she);
        saying(she, "you", her);
        saying(it, "him", "fred");
    }

    public static void saying(String it, String her, String she) {
        System.out.println(she + " can't take " + it + " with " + her);
    }
}
saying(you, it, you);
saying(it, her, she);
saying(she, "you", her);
saying(it, "him", "fred");

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.