基本型別包裝 (Wrapper Classes) 將基本型別生成物件,要將基本型別先包裝成物件,才能執行生成, Boxing: Integer a = new Integer(1) Unboxing: int x = a.intValue() Autoboxing(JDK1.5以後支援) Integer a = 1 [物 <= 基] ok int x = new Integer(1) [基 <= 物] ok 獲取其值 xxxValue() % Byte / Short / I…
Thread Safety in Java is a very important topic. Java provide multi-threaded environment support using Java Threads, we know that multiple threads created from same Object share object variables and this can lead to data inconsistency when the thread…