title: Local usage of new keyword
body: <p>I didn't expect that <code>new</code> doesn't change the instance variables if instance variables are already assigned. </p>
  
  <p>Did I understand correctly?</p>
  
  <pre><code>class Foo {
      String name = "Java";
  }
  class Main {
      public static void main(String args[]) {
          Foo foos[] = { new Foo(), new Foo() };
          foos[0].name = "bar";
          for (Foo c : foos) c = new Foo();
          for (Foo c : foos) System.out.println(c.name);
          for (Foo c : foos) c.name = "baz";
          for (Foo c : foos) System.out.println(c.name);
      }
  }
  </code></pre>
  
  <p>Output</p>
  
  <pre><code>bar
  Java
  baz
  baz
  </code></pre>
  
  <p>In the above example, the <code>new</code> works more like casting the object to the same class is already it. What is the practical use for this behavior?</p>