title: Print arraylist in java
body: <p>Actually here is an arrayList and i want it to print. But everytime i'm getting error. someone please help me out.<code>class Product</code></p>
  
  <pre><code>List&lt;Product&gt; pd = new ArrayList&lt;Product&gt;();
  pd.add( new Product("Trouser",40, 499,"Cotton", "Black"));
  pd.add( new Product("Shirt",32, 999, "Cotton","White"));
  pd.add( new Product("T-Shirt",32, 599 ,"Cotton","Blue"));
  pd.add( new Product("Blazer",32, 1299 ,"Cotton","Brown"));
  </code></pre>
  
  <p>So this is the arrayList .. i need to print it .
  I tried this way-</p>
  
  <pre><code>public static void main(String [] ar)
  {
  Product pd = new product();
  for(Object o : pd)
      {
      Product pd = (Product)o;
      System.out.println(pd);
      }
  </code></pre>
  
  <p>But its not working. Someone please help.
  Note: Main method is also a part of class Product.</p>
  
  <p>Thanks in advance!!</p>