title: adding counter in enhanced for loop
body: <p>I have a code which takes name and number from user and save those in an arraylist as object.</p>
  
  <p>I am using this enhanced for loop to printout all name and number which is stored in that arraylist ...</p>
  
  <pre><code>for(Objectclass p : Test) {
      System.out.println("Name: " + p.getName() + "   Number: " + p.getNumber());
      }
  </code></pre>
  
  <p>it prints like <strong>Name: blah blah  Number: blah blah</strong> </p>
  
  <p>now i want to add counter number before Name and number like 
  <strong>1.Name: blah blah  Number: blah blah
  2.Name ... number 
  3.Name ... number</strong> </p>
  
  <p>... how can i add that ? if i use another for loop inside this for loop to add counter number ... it prints again and again. </p>