Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Who's Who in Java

Who's Who in Java

2023.08.26 むきむきJava 発表資料

Yuichi.Sakuraba

August 27, 2023
Tweet

More Decks by Yuichi.Sakuraba

Other Decks in Technology

Transcript

  1. &MWJT-JWFT public class Elvis { public static final Elvis INSTANCE

    = new Elvis(); private final int beltSize; private static final int CURRENT_YEAR = Year.now().getValue(); private Elvis () { beltSize = CURRENT_YEAR - 1930; } public int beltSize() { return beltSize; } public static void main(String... args) { System.out.println("Elvis wears size " + INSTANCE.beltSize() + " belt."); } } 1) Elvis wears size 0 belt. 2) Elvis wears size -1930 belt. 3) Elvis wears size 93 belt. 4) Null Pointer Exception
  2. &MWJT-JWFT public class Elvis { public static final Elvis INSTANCE

    = new Elvis(); private final int beltSize; private static final int CURRENT_YEAR = Year.now().getValue(); private Elvis () { beltSize = CURRENT_YEAR - 1930; } public int beltSize() { return beltSize; } public static void main(String... args) { System.out.println("Elvis wears size " + INSTANCE.beltSize() + " belt."); } } 1) Elvis wears size 0 belt. 2) Elvis wears size -1930 belt. 3) Elvis wears size 93 belt. 4) Null Pointer Exception