public class Main { static Bar bar; static { try { bar = new Bar(); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] argv) { System.out.println(bar); } } class Bar { public Bar() throws Exception { } public String toString() { return "Bar"; } }