|
Last change
on this file since 3127 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:
373 bytes
|
| Line | |
|---|
| 1 | // Test to make sure static initializers are called
|
|---|
| 2 |
|
|---|
| 3 | class bar
|
|---|
| 4 | {
|
|---|
| 5 | public static int zog;
|
|---|
| 6 | public static int zag;
|
|---|
| 7 |
|
|---|
| 8 | static
|
|---|
| 9 | {
|
|---|
| 10 | zog = 12;
|
|---|
| 11 | zag = 2;
|
|---|
| 12 | }
|
|---|
| 13 |
|
|---|
| 14 | public bar() { }
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 | public class StaticConstructor
|
|---|
| 18 | {
|
|---|
| 19 | static int foo ()
|
|---|
| 20 | {
|
|---|
| 21 | return new bar().zog;
|
|---|
| 22 | }
|
|---|
| 23 |
|
|---|
| 24 | public static void main(String args[])
|
|---|
| 25 | {
|
|---|
| 26 | System.out.println ("" + (foo() + bar.zag));
|
|---|
| 27 | }
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.