Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Global {
- public static final Item ITEM;
- public static final int CONST_1 = 0xdeadbeef;
- static {
- System.out.println("Global {static} -> Before Item Initialization");
- ITEM = new Item();
- System.out.println("Global {static} -> After Item Initialization");
- }
- }
- public class Item {
- public static final Item INSTANCE = Global.ITEM;
- public static final int CONST_2 = 0xdeadbeef;
- public Item() {
- System.out.print("Item() -> INSTANCE = " + INSTANCE);
- System.out.print(", CONST_1 = " + Integer.toHexString(Global.CONST_1));
- System.out.println(", CONST_2 = " + Integer.toHexString(CONST_2));
- }
- }
- Global {static} -> Before
- Item() -> INSTANCE = null, CONST_1 = deadbeef, CONST_2 = beefdead
- Global {static} -> After
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement