source:
trunk/src/gcc/libjava/testsuite/libjava.lang/instinit2.java@
2
| Last change on this file since 2 was 2, checked in by , 23 years ago | |
|---|---|
|
|
| File size: 806 bytes | |
| Line | |
|---|---|
| 1 | // Class instinit2 |
| 2 | // Generated on Wed Feb 2 17:52:49 PST 2000 |
| 3 | // The instance initializer throws a checked exception. This is OK |
| 4 | // since the constructors declares it in its `throws' clause -- at |
| 5 | // least that's what the specs are saying. |
| 6 | |
| 7 | class instinit2 { |
| 8 | |
| 9 | String buffer = "Oink Oink!"; |
| 10 | |
| 11 | { |
| 12 | System.out.println ("Checking the oink..."); |
| 13 | if (buffer != null) |
| 14 | throw new Exception ("It just oinked"); |
| 15 | } |
| 16 | |
| 17 | instinit2 () throws Exception |
| 18 | { |
| 19 | System.out.println ("Ctor"); |
| 20 | } |
| 21 | |
| 22 | public static void main (String[] arg) |
| 23 | { |
| 24 | System.out.println ("Testing class `instinit2'..."); |
| 25 | try { |
| 26 | System.out.println (new instinit2 ().buffer); |
| 27 | } catch (Exception e) { |
| 28 | System.out.println (e.toString()); |
| 29 | } |
| 30 | } |
| 31 | } |
Note:
See TracBrowser
for help on using the repository browser.
