// this_iv2

class Person {
    private String name;
    private Person friend;

    // constructor
    public Person(String name) {
	this.name = name;
    }

    // set Person's name
    public String get_name() {
	return name;
    }
    
    // return name of current Person's friend
    public String get_friendName() {
	return friend.name; 
	// note: don't need to use method -- can use direct access
	// because both friend and current object belong to same class!
	// stylistically, you should still use a getter method
    }
    
    // set the current Person and another Person p to be
    // mutual friends
    public void make_friends(Person p) {
	friend = p;
	p.friend = this; // $this$ refers to current object
    }

}

public class this_iv2 {
    
    public static void main(String[] args) {
	
	Person a = new Person("Borgir");
	Person b = new Person("Dimmu");

	a.make_friends(b);

	System.out.println(a.get_friendName());
	System.out.println(b.get_friendName());

    }

}
	
/* Ouput:
Dimmu
Borgir
*/
