In AP Computer Science A, a library is a collection of prewritten classes, grouped into packages, that you can use to create objects and call methods instead of writing everything from scratch. The API specification documents how each library class works (Topic 1.7).
A library is a collection of classes someone else already wrote and tested, organized into packages so they're easy to find. Java ships with a huge standard library, and that's why you can write new Random() or numbers.add(5) without ever building those classes yourself. Per EK 1.7.A.1, each class in a library defines a specific reference type, and you can use library classes to create objects in your own programs.
The catch is that you can't use a class well without knowing its attributes (the data it stores in variables) and behaviors (what instances of the class can do, exposed through methods). That's where the API specification comes in. The API is the documentation that tells you a class's constructors, method signatures, and what each method returns. Think of it this way. The library is the toolbox, and the API documentation is the instruction manual that tells you what each tool does and how to hold it.
Libraries live in Topic 1.7 (Application Program Interface (API) and Libraries) in Unit 1: Using Objects and Methods, supporting learning objective [AP Comp Sci A 1.7.A], which asks you to identify the attributes and behaviors of a class found in the libraries contained in an API. This matters because the entire AP CSA course is built on using library classes. String, Math, Random, and ArrayList are all library classes, and every FRQ you write will lean on at least one of them. Reading API documentation for an unfamiliar class is also a tested skill in its own right. The exam regularly hands you a class you've never seen, describes its constructor and methods, and expects you to use it correctly based on the documentation alone.
Keep studying AP® Computer Science A Unit 1
API Specification (Unit 1)
Libraries and APIs are a matched pair in Topic 1.7. The library is the actual collection of classes, and the API specification is the documentation telling you how to use them. You need the API docs to know which constructors and methods a library class gives you.
Attributes and Behaviors (Unit 1)
EK 1.7.A.2 defines attributes as the data of a class (stored in variables) and behaviors as what instances of the class can do. When you read a library class's API documentation, you're really hunting for these two things so you know what objects of that class store and do.
ArrayList and the java.util Package (Unit 4)
ArrayList is the most-used library class on the exam, and it's your best concrete example of how libraries work. It lives in the java.util package, so you have to write import java.util.ArrayList; before using it. That import statement is the library system in action.
Writing Your Own Classes (Unit 3)
In Unit 1 you consume library classes through their documentation. In Unit 3 you flip roles and write the class yourself, defining the constructors and public methods that someone else would read about in an API. Understanding libraries first makes class design make sense later.
Libraries show up on multiple-choice questions in a few predictable ways. One common stem gives you API documentation for a class you've never seen (for example, a Widget class with a Widget(int size) constructor and a getWeight() method) and asks which code segment uses it correctly. Another tests whether you know that classes like ArrayList and Random need import statements from java.util, and a third gives you a custom class spec like DataProcessor and asks you to identify its attributes and behaviors from the documentation. No FRQ will ask you to define the word library, but every FRQ depends on this skill. The provided class descriptions in FRQ prompts are essentially mini API specifications, and your job is to read them and call constructors and methods with the right signatures.
These get used interchangeably in casual conversation, but the CED draws a line. A library is the collection of classes themselves, grouped into packages. The API specification is the documentation that tells a programmer how to use those classes, including their attributes and behaviors. Shortcut for the exam: library = the code, API = the instructions for the code.
A library is a collection of prewritten classes grouped into packages, and you use those classes to create objects in your own programs.
The API specification is the documentation for a library, and it's how you learn a class's attributes (data stored in variables) and behaviors (what objects of the class can do).
Each class in a library defines a specific reference type, which is why ArrayList<Integer> numbers declares a reference, not a primitive.
Classes like ArrayList and Random come from the java.util package and require an import statement before you can use them.
The exam tests whether you can read API documentation for an unfamiliar class and correctly call its constructor and methods, so practice that skill, not memorizing class names.
A library is a collection of prewritten classes, grouped into packages, that you can use to create objects and call methods in your programs. It's covered in Topic 1.7 of Unit 1, alongside the API specification that documents how those classes work.
No, and the CED distinguishes them. The library is the actual collection of classes, while the API specification is the documentation that tells you how to use those classes, including their constructors, attributes, and behaviors.
For classes outside the default packages, yes. ArrayList and Random both live in java.util, so you need import java.util.ArrayList; or import java.util.Random; at the top of your file. Classes like String and Math are available automatically.
Almost certainly not as a vocabulary question. Instead, the exam hands you API documentation for a class you've never seen and asks you to use it correctly, like calling a constructor with the right parameters or choosing the method that returns what you need.
String, Math, Random, and ArrayList are the big ones that appear across the course and on FRQs. But the more important skill is reading any class's documentation, since the exam loves giving you custom classes and testing whether you can use them from the spec alone.
Connect this key term to the AP exam workflow: review the course, practice questions, and check related study tools.
Review units, study guides, and course resources.
Check this vocabulary in multiple-choice context.
Apply key concepts in written AP responses.
Estimate the exam score you are working toward.
Review the highest-yield facts before practice.
Put the full course together before test day.