title: Default constructor vs. inline field initialization
body: <p>What's the difference between a default constructor and just initializing an object's fields directly?</p>
  
  <p>What reasons are there to prefer one of the following examples over the other?</p>
  
  <h3>Example 1</h3>
  
  <pre><code>public class Foo
  {
      private int x = 5;
      private String[] y = new String[10];
  }
  </code></pre>
  
  <h3>Example 2</h3>
  
  <pre><code>public class Foo
  {
      private int x;
      private String[] y;
  
      public Foo()
      {
          x = 5;
          y = new String[10];
      }
  }
  </code></pre>