title: Why can I create multiple instances with the same name in a loop?
body: <p>I don't understand why this works and I hope somebody can explain it to me.
  Here is an example:</p>
  
  <pre><code>TestObject array[] = new TestObject[10];
  for(int i= 0; i &lt;= 10; i++){
      TestObject object = new TestObject();
  
       object.setValue(i);
       array[i] = object;
      System.out.println(array[i].getObject());
  }
  </code></pre>
  
  <p>Why can I create multiple instances of "TestObject" with the same name in the loop?
  Usually you can't create instances with the same name:</p>
  
  <pre><code>TestObject o = new TestObject(1);
  TestObject o = new TestObject(2);
  </code></pre>
  
  <p>Well, this will obviously throws an error...</p>