class Person { private String name; // name of current Person private Person friend; // friend of current Person public Person(String name) { this.name = name; } // Set current Person's $friend$: public void makeFriends(Person friend) { this.friend = friend; friend.friend = this; } // Return description of current object: public String toString() { return "Name: "+name+"; Friend: "+friend.name; } } public class this0 { public static void main(String[] args) { // create 2 new people: Person a = new Person("Ira"); Person b = new Person("Able"); // make friends: a.makeFriends(b); // print descriptions: System.out.println(a); System.out.println(b); } } /* output: Name: Ira; Friend: Able Name: Able; Friend: Ira */