1.7

Application Program Interface (API) and Libraries

APIs and libraries provide documented collections of classes whose attributes and behaviors programmers use to create objects.

1525% of exam
Understand It
Ace It
Context

What this topic is and why it exists

Imagine moving to a new city where you don't speak the language — but someone hands you a perfectly organized phrasebook.
It tells you exactly what to say at a restaurant, how to ask for directions, and what words to use at the train station.
You don't need to invent the language yourself; you just need to know where to look.
That's essentially what an API — an Application Programming Interface — does for you as a programmer.
An API is a collection of pre-built classes, bundled into organized groups called packages, and each class comes with documentation that acts like your phrasebook.
It tells you what a class *has* (its attributes, stored in variables — think of these as the nouns, the data a class carries around) and what a class *does* (its behaviors, defined by methods — think of these as the verbs, the actions you can perform).
You don't need to build everything from scratch.
Someone already wrote a `String` class, a `Math` class, dozens of tools ready for you to use.
The real skill isn't memorizing every class — it's learning to read the documentation so you can pick up any unfamiliar class and immediately understand what it stores and what it can do.
Master that, and you'll never feel lost in the language again.
1 / 9