Java Core API
In this chapter, we will delve more deeply into popular classes and interfaces from the Java API. We will start with the Scanner
class, which is commonly used for scanning and parsing text from sources such as the keyboard (the user). We will then examine the very popular String
and StringBuilder
classes. We will discuss their differences, which will require contrasting mutable and immutable types. We will also show you how to design immutable types and look at the List
interface and its popular implementation class, ArrayList
. Lastly, we will examine the Date API, which was overhauled in Java 8.
For further details on the types covered in this chapter, please refer to the Java Docs API: https://docs.oracle.com/en/java/javase/21/docs/api/index.html.
This chapter covers the following main topics:
- Understanding the
Scanner
class - Comparing
String
withStringBuilder
- Designing an immutable type
- Examining
List
andArrayList
- Exploring the Date API...