Arrays and Collections
Arrays
Both int[] a and int a[] declare the same type. new int[3] is zero-filled; length is a field, not a method. Arrays are covariant (Object[] o = new String[1] compiles), so storing an incompatible type throws ArrayStoreException at runtime. Multi-dimensional arrays are arrays of arrays, so new int[2][] is legal and rows may differ in length. Use Arrays.toString for flat arrays and deepToString for nested ones; Arrays.asList is fixed-size but writes through to the backing array.
Collections framework
Choose by contract: List (ordered, duplicates, indexed), Set (unique elements), Queue/Deque (FIFO and double-ended), Map (unique keys). ArrayList is the default list; HashSet/HashMap give no ordering guarantee and rely on equals/hashCode; LinkedHashSet/LinkedHashMap preserve insertion order; TreeSet/TreeMap sort using Comparable or a supplied Comparator and throw ClassCastException for non-comparable keys. ArrayDeque rejects null; Queue offers both throwing (add/remove/element) and safe (offer/poll/peek) forms.
Traps
List.of/Set.of/Map.of are immutable - no null elements, UnsupportedOperationException on mutation; Collections.unmodifiableList is only a read-only view over a still-mutable backing list. With List<Integer>, remove(1) removes by index; use remove(Integer.valueOf(1)) to remove a value. Mutating a HashMap key after insertion makes the entry unreachable. Use Comparator.comparing(...).thenComparing(...) for multi-key sorts.
Worked rule: when a question mixes generics and mutation, check the wildcard - List<? extends Number> cannot be added to, List<? super Integer> can accept Integer.