logo Practice-It logo

parameter mystery

Author: Marty Stepp (on 2010/12/28)

Write the output of each of the method calls in the following program, as it would appear on the console.

public class ParameterMystery {
    public static void main(String[] args) {
        int a = 5;
        int b = 1;
        int c = 3;
        int three = a;
        int one = b + 1;

        axiom(a, b, c);
        axiom(c, three, 10);
        axiom(b + c, one + three, a + one);
        a++;
        b = 0;
        axiom(three, 2, one);
    }

    public static void axiom(int c, int b, int a) {
        System.out.println(a + " + " + c + " = " + b);
    }
}
axiom(a, b, c);
axiom(c, three, 10);
axiom(b + c, one + three, a + one);
axiom(three, 2, one);

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.