title: Unhandled exceptions in field initializations
body: <p>Does Java have any syntax for managing exceptions that might be thrown when declaring and initializing a class's member variable?</p>
  
  <pre><code>public class MyClass
  {
    // Doesn't compile because constructor can throw IOException
    private static MyFileWriter x = new MyFileWriter("foo.txt"); 
    ...
  }
  </code></pre>
  
  <p>Or do such initializations always have to be moved into a method where we can declare <code>throws IOException</code> or wrap the initialization in a try-catch block?</p>