/** Demo program that uses class Num */ public class ParameterTester { public static void main( String[] args ) { int a1 = 111; Num a2 = new Num(222); Num a3 = new Num(333); System.out.println("before call: \ta1=" + a1 + ", \ta2=" + a2 + ", \ta3=" + a3); changeValues(a1, a2, a3); System.out.println("after call: \ta1=" + a1 + ", \ta2=" + a2 + ", \ta3=" + a3); } public static void changeValues(int f1, Num n1, Num n2) { System.out.println("start call: \tf1=" + f1 + ", \tn1=" + n1 + ", \tn2=" + n2); f1 = 999; n1.setValue(888); n2 = new Num(777); System.out.println("end call: \tf1=" + f1 + ", \tn1=" + n1 + ", \tn2=" + n2); } } /** Simple number class which has an int data field, a c'tor, a modifier method to set the private field and overrides toString method of class Object */ class Num { public Num(int update) { value = update; } public void setValue(int update) { value = update; } public String toString() { return Integer.toString(value); } private int value; }