class ParamTest { public static void testParams(Student s, int num) { num = 20; // doesn't change count: this is only a copy of it. s.setFirstName("Rudiger"); // works: follow (copied) reference // & change contents s = new Student(300067890, "someguy"); // doesn't change s1, just // changes s from a copy of s1 to // a reference to a new Student. } public static void main(String[] args) { Student s1 = new Student(300012345, "userid"); int count = 10; s1.setLastName("Simpson"); testParams(s1, count); System.out.println(s1); // 300012345: Simpson, Rudiger System.out.println(count); // 10 } }