Skip to content

Chapter 26 of 37

Java Standard Libraries

Navigate java.lang, java.util, java.io, java.nio, time, math, and documentation.

34 minutes 10 quick checksBy Subha Prasad
Lesson 26 of 37Course navigation

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.

Which statement best describes java.lang?
Which Java term matches this description: Automatically imported fundamental types such as Object, String, and Math.
Which statement best describes java.util?
Which Java term matches this description: Utilities including collections, Optional, Random, and Scanner.
Which statement best describes java.io?
Which Java term matches this description: Classic stream, reader, writer, and serialization APIs.
Which statement best describes java.nio?
Which Java term matches this description: Buffer, channel, charset, and modern filesystem APIs.
Which statement best describes Javadoc?
Which Java term matches this description: API documentation generated from structured source comments.

0 of 10 checks passed

Your progress is saved on this device.

Java Standard Libraries | Java Lesson | Subha Prasad