Checked exception and initializer block
<p>According to JLS -It is a compile-time error if an instance variable initializer or instance initializer of a named class can throw a checked exception class unless that exception class or one of its superclasses is explicitly declared in the throws clause of each constructor of its class and the class has at least one explicitly declared constructor.
So if i do this -</p>

<pre><code>class A{
 {
  throw new FileNotFoundException();
 }
public A() throws IOException{
    // TODO Auto-generated constructor stub
}
}
</code></pre>

<p>this gives a complie time error "initializer must complete normally"</p>

<p>while</p>

<pre><code>class A{
 {
  File f=new File("a");
  FileOutputStream fo=new FileOutputStream(f);
  fo.write(3);
 }
public A() throws IOException{
    // TODO Auto-generated constructor stub
}
}
</code></pre>

<p>this code doesnt show any compile time error .</p>

<p>hence the question is why the previous code doesnt complie even if i hav declared throws clause in constructor.</p>
