Lesson content
Read, practise, then check your understanding
java.lang supplies Object, String, Math, wrappers, threads, and system facilities and is automatically imported. java.util contains collections, Optional, random generators, and utilities; java.io and java.nio cover I/O; java.time models date/time.
Prefer standard abstractions
Instant now = Instant.now();
Duration timeout = Duration.ofSeconds(5);
List<String> copy = List.copyOf(source);
Objects.requireNonNull(value, "value");
Read Javadoc contracts for nullability, exceptions, mutability, complexity, and thread safety. Use modern focused APIs—java.time over legacy date types, NIO Paths over string path manipulation—and avoid reimplementing tested library behavior. API availability depends on the project’s minimum Java release.
Knowledge check
Answer every question correctly to complete this chapter.
0 of 10 checks passed
Your progress is saved on this device.