// Zorah Fung, CSE 142 // This is an exercise to help understand parameters. There will be a // question exactly like this on the midterm! public class ParameterMystery { public static void main(String[] args) { int w = 4; int x = 9; int y = 2; int z = 5; // Note: We are passing the VALUES stored in z, y, x, not the variables themselves. mystery(z, y, x); mystery(y, w, z); w += 3; mystery(w, w, z); } // Note: There is no relationship between the parameter names x, z, y here and // the variable names in main. The variables in main are out of scope at this point. public static void mystery(int x, int z, int y) { // int x = first value passed // int z = second value passed // int y = third value passed System.out.println(z + " and " + (y - x)); } }