logo CodeStepByStep logo

ParameterMysteryExam1

Language/Type: Java parameters return

The following console program uses parameters and produces five lines of output. What are they?

public class ParameterMysteryExam1 {
    public static void main(String[] args) {
        String x = "java";
        String y = "tyler";
        String z = "tv";
        String rugby = "hamburger";
        String java = "donnie";

        hamburger(x, y, z);
        hamburger(z, x, y);
        hamburger("rugby", z, java);
        y = hamburger(y, rugby, "x");
        hamburger(y, y, "java");
    }

    public static String hamburger(String y, String z, String x) {
        System.out.println(z + " and " + x + " like " + y);
        return z;
    }
}
line 1
line 2
line 3
line 4
line 5

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.