codice:
private void createRooms()     {         Room outside, courtyard, throneroom, stairs, doungeon, hallways;                // create the rooms         outside = new Room("outside the Castle");         courtyard = new Room("in Countyard");         throneroom = new Room("in the throneroom");         stairs = new Room("on the stairs");         doungeon = new Room("in the doungeon");         hallways= new Room("in the hallways");                  // initialise room exits         outside.setExit("north", courtyard);                  courtyard.setExit("east", throneroom);         courtyard.setExit("South", courtyard);                  throneroom.setExit("north", stairs);         throneroom.setExit("west", stairs);                  stairs.setExit("up", hallways);         stairs.setExit("down", doungeon);         stairs.setExit("south", throneroom);                  doungeon.setExit("up", stairs);          hallways.setExit("dowwn", stairs);          currentRoom = outside;  // start game outside     }

solo che vorrei riuscirli a creare in trammite un array in modo da poter controllare l'indice con un randoom che ho creato prima e settare un campo della classe Room che si chiama chiave a true ma solo per quella stanza solo che non ho idea di come fare o meglio quelli che ho provato non vanno qualcuno potrebbe darmi una mano...