logo CodeStepByStep logo

ParameterMysteryExam5

Language/Type: Java parameters return

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

public class ParameterMysteryExam5 {
    public static void main(String[] args) {
        int a = 10;
        int b = 4;
        int c = a + b;

        int d = mystery(a, b, c);
        b--;
        c = mystery(c, d, a);
        mystery(a, c, b);
        System.out.println(a + " " + b + " " + c + " " + d);
    }

    public static int mystery(int b, int c, int a) {
        c++;
        System.out.println(c + " " + a + " " + b);
        return a + 2;
    }
}
line 1
line 2
line 3
line 4

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.