instinit2.java 806 Bytes
Newer Older
Tom Tromey committed
1
// Class instinit2
2 3 4 5 6
// Generated on Wed Feb  2 17:52:49 PST 2000
// The instance initializer throws a checked exception. This is OK
// since the constructors declares it in its `throws' clause -- at
// least that's what the specs are saying.

Tom Tromey committed
7
class instinit2 {
8 9 10 11 12 13 14 15 16

    String buffer = "Oink Oink!";

    {
        System.out.println ("Checking the oink...");
        if (buffer != null)
            throw new Exception ("It just oinked");
    }

Tom Tromey committed
17
    instinit2 () throws Exception
18 19 20 21 22 23
    {
        System.out.println ("Ctor");
    }

    public static void main (String[] arg)
    {
Tom Tromey committed
24
        System.out.println ("Testing class `instinit2'...");
25
        try {
Tom Tromey committed
26
            System.out.println (new instinit2 ().buffer);
27 28 29 30 31
        } catch (Exception e) {
            System.out.println (e.toString());
        }
    }
}