title: How do you make an Arraylist of RandomNumber integers? java
body: <p>So I am relatively new to the programming scene and I am confused as to why my code doesn't work. I am trying to make an <code>arraylist</code> of flowers and then use a random number generator to create a random number of certain flowers, and store them in the array. In my logic, I thought that I created a variable to store the numbers (ex <code>randomRoses</code>) and stored the number in the array so I could easily print out how many of each flower there is by just calling the <code>arraylist</code> and the position. (ex <code>flowerArray[0]</code> would print out 8 Roses) but sadly it does not. </p>
  
  <pre><code>public class Flower
  {
  
      private int randomRoses;
      private int randomTulips;
      private int randomOrchids;
      public ArrayList &lt;Integer&gt; flowerArray;
  
      public Flower()
      {
          r = new Random();
          t = new Random();
          o = new Random();
          int randomRoses = (r.nextInt(10) + 0);
          int randomTulips = (t.nextInt(10) + 0);
          int randomOrchids = (o.nextInt(10) + 0);
          flowerArray = new ArrayList&lt;Integer&gt;
      }
  
      public void add2Array ()
      {
          flowerArray.add(randomRoses); //flowerArray[0] is the # of roses
          flowerArray.add(randomTulips); //flowerArray[1] is the # of tulips
          flowerArray.add(randomOrchids); //flowerArray[2] is the # of orchids
      }
  
      public void printArray()
      {
          System.out.println(flowerArray[0]);
      }
  </code></pre>