title: Java String array created inside loop
body: <p>I have a question regarding the differences of the following codes:     </p>
  
  <pre><code>Vector v = new Vector();
  String [] str_arr = new String[3];
  
  for(int i=0; i&lt;3; i++)
  {
     str_arr[0] = "A";
     str_arr[1] = "B";
     str_arr[2] = "C";            
     v.add(str_arr);
  }
  System.out.println(v.size());  //answer 3
  </code></pre>
  
  <p>Versus</p>
  
  <pre><code>Vector v = new Vector();
  
  
  for(int i=0; i&lt;3; i++)
  {
     String [] str_arr = new String[3];
     str_arr[0] = "A";
     str_arr[1] = "B";
     str_arr[2] = "C";            
     v.add(str_arr);
  }
  System.out.println(v.size());  //answer 3
  </code></pre>
  
  <p>The only difference between both codes is, for the second one, string array is created inside the loop.</p>
  
  <p>Both the codes produce same result, but i want to know what is the difference between these two.</p>