So, i'm new to coding and am working on an exercise with this code.
What I'm wondering is what "nextRoom = currentRoom.northExit;" etc does as in my eyes the dot notation should be used as object.method(parameters) as opposed to object1.object2 ?
class Room
private String description;
private Room northExit;
private Room southExit;
private Room eastExit;
private Room westExit;
class Game
private Room currentRoom;
private void move(String direction)
{
Room nextRoom = null;
if(direction.equals("north")) {
nextRoom = currentRoom.northExit;
}
}
Thanks in advance !