...
Code Block | ||
---|---|---|
| ||
class Foo { static public final int VERSION = 1; // ... } |
Bar.java:
Code Block | ||
---|---|---|
| ||
class Bar { public static void main(String[] args) { printf("You are using version " + Foo.VERSION); } } |
...
Foo.java:
Code Block | ||
---|---|---|
| ||
class Foo { static private final int version = 1; static public String getVersion() { return version; } // ... } |
Bar.java:
Code Block | ||
---|---|---|
| ||
class Bar { public static void main(String[] args) { printf("You are using version " + Foo.getVersion()); } } |
...