title: Creating multiple objects with same name through a loop
body: <p>I'm trying to create and use several instances of a class called Room in another class called TextGame. The TextGame class has an instance variable called numRooms, and the boolean expression of the loop ends at that instance variable. The only problem I'm having is that the loop creates an object with the same name as the last one. I'm not sure if that overrides the object resulting in only one object at the end of the loop. </p>
  
  <p>Here is the method that contains the loop:</p>
  
  <pre><code>public void makeRooms(){
      Scanner keyboard = new Scanner(System.in);
      for(int i = 0; i &lt; numRooms; i++){
          System.out.println("What riddle do you want in Room " + (i+1) + "?");
          String riddle = keyboard.nextLine();
          System.out.println("What is the answer for that riddle?");
          String answer = keyboard.nextLine();
          Room room = new Room(riddle, answer);
      }
  }
  </code></pre>
  
  <p>Is there a way I can name the Room objects based on the value of i at each iteration?</p>