Class Definition
/* Collection of rooms. */
import java.io.*;
public class Room {
// Each room r has a unique r.id > 0.
// nextId is the ID# of the next room
// to be created.
private static int nextId = 1;
private int id;
// Create a new room with a unique ID#.
public Room() {
id = nextId;
nextId = nextId + 1;
}
}
Previous slide
Next slide
Back to first slide
View graphic version