---
title: "Import Statement — AP Comp Sci A Definition & Exam Guide"
description: "An import statement brings classes from other Java packages into your file so you can use short names like ArrayList. Learn what AP CSA actually expects."
canonical: "https://fiveable.me/ap-comp-sci-a/key-terms/import-statement"
type: "key-term"
subject: "AP Computer Science A"
---

# Import Statement — AP Comp Sci A Definition & Exam Guide

## Definition

An import statement in Java (e.g., import java.util.ArrayList;) tells the compiler where to find a class from another package so you can use its short name instead of its fully qualified name. On the AP CSA exam, imports are assumed, so you never lose points for omitting them in FRQs.

## What It Is

An import statement is a line at the top of a Java [file](/ap-comp-sci-a/key-terms/file "fv-autolink"), like `import java.util.ArrayList;`, that pulls a [class](/ap-comp-sci-a/unit-3/abstraction-and-program-design/study-guide/o9VgVeIpKRYZ7N7rXfUz "fv-autolink") from another package into your program. Without it, you'd have to write the fully qualified name every single time, so `java.util.ArrayList` instead of just `ArrayList`. The import is basically a shortcut that says "when I write ArrayList, I mean the one in java.util."

Java automatically imports everything in the `java.lang` package, which is why you can use `String`, `Math`, `Integer`, and `System.out` without any import at all. Classes outside `java.lang`, most famously `ArrayList` in `java.util`, technically need an import in real code. Here's the AP-specific part though: the exam assumes all necessary imports are already in place. You'll see code using `ArrayList` on the exam with no import shown, and when you write FRQ solutions, you should skip imports entirely and jump straight to the method or class you're asked to write.

## Why It Matters

Import statements show up the moment you start working with `ArrayList` in Unit 7, because `ArrayList` lives in `java.util` rather than the auto-imported `java.lang`. Understanding imports also helps you read any real Java code your teacher or IDE throws at you, since the import lines at the top are a quick map of which [libraries](/ap-comp-sci-a/key-terms/library "fv-autolink") the program depends on. The bigger conceptual win is that imports teach you how Java organizes code into [packages](/ap-comp-sci-a/key-terms/package "fv-autolink"), which is the foundation for understanding why some classes (like `String` and `Math`) work out of the box while others don't. Just remember the exam's stance, which is that imports are background plumbing, not something you're graded on writing.

## Connections

### [Package (Unit 7 context)](/ap-comp-sci-a/key-terms/package)

Packages are the folders Java uses to organize classes, and an import statement is how you reach into one of those folders. `java.util` is a package; `import java.util.ArrayList;` grabs one class out of it. You can't really understand imports without packages, since an import is just a package address plus a class name.

### [ArrayList constructor (Unit 7)](/ap-comp-sci-a/key-terms/arraylist-constructor)

This is the one place AP CSA actually bumps into imports. Before you can call `new ArrayList<Integer>()`, real Java code needs `import java.util.ArrayList;` because [ArrayList](/ap-comp-sci-a/unit-4/developing-algorithms-using-arraylists/study-guide/MKbteieYvLOpWIwfqiND "fv-autolink") isn't in java.lang. On the exam that import is assumed, but in your own IDE, forgetting it is the classic 'cannot find symbol' error.

### Static Import (beyond the AP subset)

A regular import brings in a class name; a [static](/ap-comp-sci-a/unit-1/calling-non-void-method/study-guide/gXkdn6sNrkDRHZsCVN1x "fv-autolink") import brings in a class's static members directly, so you could write `sqrt(x)` instead of `Math.sqrt(x)`. AP CSA never requires static imports, and you should write `Math.sqrt` the normal way on the exam.

### Classpath (beyond the AP subset)

The import statement tells the [compiler](/ap-comp-sci-a/key-terms/compiler "fv-autolink") which class you mean, but the classpath tells the JVM where to actually find that class's compiled file on your computer. Imports are addresses; the classpath is the road map. This distinction matters in real development, not on the AP exam.

## On the AP Exam

Import statements are essentially exam-proof, in a good way. FRQ instructions assume any needed imports are present, so you should never write `import java.util.ArrayList;` at the top of an FRQ answer, and you'll never be penalized for leaving it out. MCQ code segments likewise show classes like `ArrayList` already usable without imports shown. What you actually need is the concept behind it: know that `java.lang` classes (String, Math, Integer, Double) are always available, know that `ArrayList` comes from `java.util`, and don't waste FRQ time on boilerplate. Spend that time on the logic the rubric actually scores, like traversals and method implementations.

## Import Statement vs Static Import

A regular import statement brings a class name into scope, so `import java.util.ArrayList;` lets you write `ArrayList` instead of `java.util.ArrayList`. A static import brings a class's static members into scope, so `import static java.lang.Math.sqrt;` would let you write `sqrt(16)` instead of `Math.sqrt(16)`. AP CSA uses neither in your answers, and exam code always calls static methods with the class name attached, like `Math.pow` and `Math.random`.

## Key Takeaways

- An import statement lets you use a class's short name (ArrayList) instead of its fully qualified name (java.util.ArrayList).
- Java automatically imports the java.lang package, which is why String, Math, and Integer never need an import.
- ArrayList lives in java.util, so real Java code needs import java.util.ArrayList; before using it.
- On the AP CSA exam, all necessary imports are assumed, so never write import statements in your FRQ answers.
- Forgetting an import in your own IDE causes a 'cannot find symbol' compile error, which is a compile-time problem, not a runtime exception.
- An import doesn't copy code into your file; it just tells the compiler which package to look in when it sees a class name.

## FAQs

### What is an import statement in Java?

It's a line at the top of a Java file, like import java.util.ArrayList;, that tells the compiler where to find a class from another package so you can refer to it by its short name. Without it, you'd have to write the full name java.util.ArrayList every time.

### Do I need to write import statements on the AP Computer Science A exam?

No. The exam assumes all necessary imports are already in place, so FRQ solutions should never include them and you won't lose points for leaving them out. Jump straight to the method or class the question asks for.

### Why doesn't String or Math need an import statement?

Because they live in the [java.lang package](/ap-comp-sci-a/key-terms/javalang-package "fv-autolink"), which Java imports automatically into every program. That's the same reason Integer, Double, and System work without any import line.

### What's the difference between an import and a static import?

A regular import brings in a class name (so you can write ArrayList), while a static import brings in a class's static members directly (so you could write sqrt(x) instead of Math.sqrt(x)). AP CSA only ever shows regular usage, and you should always write Math.sqrt, Math.pow, etc. with the class name.

### Does forgetting an import statement cause a runtime exception?

No, it causes a compile-time error, typically 'cannot find symbol,' which means your code never runs at all. Runtime exceptions like NullPointerException or IndexOutOfBoundsException happen while the program is running, which is a different category of error.

## Structured Data

```json
{"@context":"https://schema.org","@graph":[{"@type":"LearningResource","@id":"https://fiveable.me/ap-comp-sci-a/key-terms/import-statement#resource","name":"Import Statement — AP Comp Sci A Definition & Exam Guide","url":"https://fiveable.me/ap-comp-sci-a/key-terms/import-statement","learningResourceType":"Concept explainer","educationalLevel":"AP® / High School","about":{"@id":"https://fiveable.me/ap-comp-sci-a/key-terms/import-statement#term"},"audience":{"@type":"EducationalAudience","educationalRole":"student"},"dateModified":"2026-06-11T00:50:32.667Z","isPartOf":{"@type":"Collection","name":"AP Computer Science A Key Terms","url":"https://fiveable.me/ap-comp-sci-a/key-terms"},"publisher":{"@type":"Organization","name":"Fiveable","url":"https://fiveable.me"}},{"@type":"DefinedTerm","@id":"https://fiveable.me/ap-comp-sci-a/key-terms/import-statement#term","name":"Import Statement","description":"An import statement in Java (e.g., import java.util.ArrayList;) tells the compiler where to find a class from another package so you can use its short name instead of its fully qualified name. On the AP CSA exam, imports are assumed, so you never lose points for omitting them in FRQs.","url":"https://fiveable.me/ap-comp-sci-a/key-terms/import-statement","inDefinedTermSet":{"@type":"DefinedTermSet","name":"AP Computer Science A Key Terms","url":"https://fiveable.me/ap-comp-sci-a/key-terms"}},{"@type":"FAQPage","mainEntity":[{"@type":"Question","name":"What is an import statement in Java?","acceptedAnswer":{"@type":"Answer","text":"It's a line at the top of a Java file, like import java.util.ArrayList;, that tells the compiler where to find a class from another package so you can refer to it by its short name. Without it, you'd have to write the full name java.util.ArrayList every time."}},{"@type":"Question","name":"Do I need to write import statements on the AP Computer Science A exam?","acceptedAnswer":{"@type":"Answer","text":"No. The exam assumes all necessary imports are already in place, so FRQ solutions should never include them and you won't lose points for leaving them out. Jump straight to the method or class the question asks for."}},{"@type":"Question","name":"Why doesn't String or Math need an import statement?","acceptedAnswer":{"@type":"Answer","text":"Because they live in the [java.lang package](/ap-comp-sci-a/key-terms/javalang-package \"fv-autolink\"), which Java imports automatically into every program. That's the same reason Integer, Double, and System work without any import line."}},{"@type":"Question","name":"What's the difference between an import and a static import?","acceptedAnswer":{"@type":"Answer","text":"A regular import brings in a class name (so you can write ArrayList), while a static import brings in a class's static members directly (so you could write sqrt(x) instead of Math.sqrt(x)). AP CSA only ever shows regular usage, and you should always write Math.sqrt, Math.pow, etc. with the class name."}},{"@type":"Question","name":"Does forgetting an import statement cause a runtime exception?","acceptedAnswer":{"@type":"Answer","text":"No, it causes a compile-time error, typically 'cannot find symbol,' which means your code never runs at all. Runtime exceptions like NullPointerException or IndexOutOfBoundsException happen while the program is running, which is a different category of error."}}]},{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"AP Computer Science A","item":"https://fiveable.me/ap-comp-sci-a"},{"@type":"ListItem","position":2,"name":"Key Terms","item":"https://fiveable.me/ap-comp-sci-a/key-terms"},{"@type":"ListItem","position":3,"name":"Import Statement"}]}]}
```
