System.out.println("Please state the name of the person: ");
name = input.next();
if(rooms[floor][app].getName().getPerson().equals(name))
This is located in a class called House. The getName is located in a class Appartment and it calls on the getPerson located in class Person. More of the code in the House class
public class House {
private House[][] rooms = new House[15][15];
int floor = 15; //number of floors
int app = 15; //number of appartments on each floor
// alot more of Strings and ints but they are not relevant to the question.
public House() {
for (int f = 0; f < floor; f++) {
for (int a = 0; a < app; a++) {
rooms[f][a] = new Appartment(roomName);
rooms[f][a].setRoomName("" + (f + 1) + (char) ('A' + a));
}
}
} // end House constructor
From the Appartment class:
public void setPerson(Person name) {
this.name = name;
}
public Person getName() {
return name;
}
From Person class:
public String getPerson() {
return name;
}
Why do I get that error? Is the program unable to retrieve the name? In that case, why? Any help would be greatly appreaciated. I really want to learn this.

New Topic/Question
Reply



MultiQuote


|