Resident - friends[numFriends = friend numFriends public...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
public class Resident{ private String name; private Resident [ ] friends; private int numFriends; public Resident(String nm){ name = nm; friends = new Resident[3]; numFriends = 0; } public void addFriend(Resident friend){
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: friends[numFriends] = friend; numFriends++; } public Resident getFriend(int i){ return friends[i]; } public String getName( ){ return name; } }...
View Full Document

This note was uploaded on 07/12/2009 for the course CS 111 taught by Professor Hari during the Fall '08 term at Rutgers.

Ask a homework question - tutors are online