=== Q01 Why is Java platform independent? === magic = CAFEBABE class file major version = 69 === Q02 JDK vs JRE vs JVM === running on Java 25 JVM: OpenJDK 64-Bit Server VM compiler available: true === Q03 Primitive types and their sizes === byte 1 byte, -128 to 127 short 2 bytes, -32768 to 32767 int 4 bytes, -2147483648 to 2147483647 long 8 bytes, -9223372036854775808 to 9223372036854775807 float 4 bytes, double 8 bytes, char 2 bytes field defaults: 0, false, null === Q04 Type casting and overflow === 7 / 2 = 3, (double) 7 / 2 = 3.5 (byte) 130 = -126 Integer.MAX_VALUE + 1 = -2147483648 c + 1 = 66, (char) (c + 1) = B 0.1 + 0.2 = 0.30000000000000004 Math.addExact: integer overflow === Q05 Autoboxing and the Integer cache === 127 == 127 -> true 128 == 128 -> false 128 equals 128 -> true Long 127 equals Integer 127 -> false === Q06 Is Java pass by value or pass by reference? === after reassign: original after mutate: original + mutated === Q07 static variables, static blocks and initialisation order === static block runs once, when the class loads instance block runs before each constructor body constructor #1 instance block runs before each constructor body constructor #2 === Q08 final, finally and finalize === final array contents changed: 99 in try finally always runs Object.finalize forRemoval = true, since 9 === Q09 Stack vs heap === heap array length = 1000000 StackOverflowError after many frames: true