|
Last change
on this file since 1389 was 1389, checked in by bird, 22 years ago |
|
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
|
|
File size:
557 bytes
|
| Line | |
|---|
| 1 | public class initexc
|
|---|
| 2 | {
|
|---|
| 3 | public static class fail
|
|---|
| 4 | {
|
|---|
| 5 | static
|
|---|
| 6 | {
|
|---|
| 7 | // Static initializers must be able to complete normally.
|
|---|
| 8 | if (true)
|
|---|
| 9 | throw new NullPointerException("nope");
|
|---|
| 10 | }
|
|---|
| 11 |
|
|---|
| 12 | public static int val ()
|
|---|
| 13 | {
|
|---|
| 14 | return 23;
|
|---|
| 15 | }
|
|---|
| 16 | }
|
|---|
| 17 |
|
|---|
| 18 | public static void main (String[] args)
|
|---|
| 19 | {
|
|---|
| 20 | try
|
|---|
| 21 | {
|
|---|
| 22 | System.out.println (fail.val ());
|
|---|
| 23 | }
|
|---|
| 24 | catch (ExceptionInInitializerError _)
|
|---|
| 25 | {
|
|---|
| 26 | // Ok.
|
|---|
| 27 | }
|
|---|
| 28 | try
|
|---|
| 29 | {
|
|---|
| 30 | System.out.println (fail.val ());
|
|---|
| 31 | }
|
|---|
| 32 | catch (NoClassDefFoundError _)
|
|---|
| 33 | {
|
|---|
| 34 | // Ok.
|
|---|
| 35 | }
|
|---|
| 36 | }
|
|---|
| 37 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.