public class Program { public static void main(String[] args) { Student a = new Student("Vasya"); Student b = new Student("Kolya"); a.tostring(); b.tostring(); swap(a, b); a.tostring(); b.tostring(); } public static void swap(Student a, Student b){ Student c; c=b; b=a; a=c; } } public class Student{ String name; public Student(String name){ this.name=name; } public void tostring(){ System.out.println(this.name); } }