title: Using arraylist with strings, int, double
body: <p>I am just starting out with arraylists so please bear with me. I am trying to create an entry at index 0 with an item name, item number, amount in stock, and the price of the item. I think that I have built my array list to use my InventoryItem class, but I am not quite sure that I have done so. Here is my InventoryItem class.</p>
  
  <pre><code>class InventoryItem { //Delcare variables below
  
  String ItemName;
  int ItemNumber;
  int InStock;
  double UnitPrice;
  double Value;
  
  public InventoryItem(String ItemName, int ItemNumber, int InStock, double UnitPrice) { //declare variables for this class
      this.ItemName = ItemName;
      this.ItemNumber = ItemNumber;
      this.InStock = InStock;
      this.UnitPrice = UnitPrice;
      this.Value = UnitPrice * InStock; //calculate value of inventory
  
  }
  
  public void output() {
      System.out.println("Item Name = " + ItemName); //print out the item name
      System.out.println("Item Number = " + ItemNumber); //print out the item number
      System.out.println("In Stock = " + InStock); //print out how many of the item are in stock
      System.out.println("Item Price = $" + UnitPrice); //print out the price per item
      System.out.println("Value of inventory = $" + Value); //calculate how much the inventory is worth for this one item
  
  }
  </code></pre>
  
  <p>As you can see there are strings, integers, and doubles listed in this class. 
  Now I have created my arraylist as shown here. (I have tried to insert them all to the 0 spot)</p>
  
  <pre><code>package inventory;
  </code></pre>
  
  <p>import java.util.ArrayList;</p>
  
  <p>public class Inventory {</p>
  
  <pre><code>public static void main(String[] args) {
      ArrayList InventoryItem = new ArrayList();
      InventoryItem.add(0, "Pencil ");
      InventoryItem.add(0, "123456789");
      InventoryItem.add(0, "1");
      InventoryItem.add(0, "1.25");
  
      for (int i = 0; i&lt; InventoryItem.size(); i++)
          System.out.printf("%s", InventoryItem.get(i));
      System.out.println();
  </code></pre>
  
  <p>My problem is that I wanted this list to take an input on a single line. Can I do something like </p>
  
  <pre><code>ArrayList&lt;String int int double&gt; Stock = new ArrayList&lt;String int int double&gt;();
  InventoryItem.add(0, "Pencil", 123456789, 1, 1.25);
  </code></pre>
  
  <p>Will this make my 0 entry as I have intended?
  I have tried to do this but it doesn't like it. I have also tried to put a comma in between each type, but that doesn't seem to work either. Maybe my display is not right for this situation? Any help would be great. This is really for a multidimensional type array where each line has these characteristics. </p>