---
title: "Primitives — AP Comp Sci A Definition & Exam Guide"
description: "Primitives are Java's basic data types (int, double, boolean) that store values directly, not objects. They anchor Unit 1 and show up in nearly every FRQ."
canonical: "https://fiveable.me/ap-comp-sci-a/key-terms/primitives"
type: "key-term"
subject: "AP Computer Science A"
---

# Primitives — AP Comp Sci A Definition & Exam Guide

## Definition

Primitives are Java's built-in basic data types that store simple values directly in memory. On AP CSA you work with three of them: int (whole numbers), double (decimals), and boolean (true/false). Unlike objects, primitives have no methods and you never call new to create them.

## What It Is

Primitives are the simplest kind of data in Java. A primitive [variable](/ap-comp-sci-a/unit-1/expressions-and-assignment-statements/study-guide/01dr6uUPDAn3SjtK2Psr "fv-autolink") holds the actual value itself, a number like 42 or 3.14, or the value true or false. That's it. There's no [object](/ap-comp-sci-a/key-terms/object "fv-autolink") wrapped around it, no methods to call, no dot notation. You can't write `5.toString()` because 5 isn't an object.

Full Java has eight primitive types, but the AP CSA exam only tests three: **int** for integers, **double** for decimal (floating-point) numbers, and **[boolean](/ap-comp-sci-a/unit-1/variables-and-primitive-data-types/study-guide/rezA6f3hJz84TKaY5Jjl "fv-autolink")** for true/false values. Everything else you work with in the course, including String, arrays, and ArrayList, is a reference type, meaning the variable stores a memory address pointing to an object rather than the value itself. That one distinction (value vs. reference) explains a huge amount of Java behavior, from why `==` works on ints but not Strings to why int division throws away the decimal.

## Why It Matters

Primitives are so foundational that the College Board named [Unit 1](/ap-comp-sci-a/unit-1 "fv-autolink") after them ([Primitive Types](/ap-comp-sci-a/key-terms/primitive-types "fv-autolink")). The unit covers declaring and initializing int, double, and boolean variables, evaluating arithmetic expressions, and casting between types. But the payoff never stops. Every later unit assumes you know how primitives behave. Loop counters in Unit 4 are ints. Conditions in Unit 3 evaluate to booleans. Array traversals, averages in 2D array FRQs, and accumulator patterns all depend on you knowing that `7 / 2` is 3 (not 3.5) and that comparing primitives with `==` is fine while comparing objects with `==` is usually a bug. If you're shaky on primitives, errors will follow you through all ten units.

## Connections

### Variable (Unit 1)

A variable is a named container, and its declared type decides what fits inside. Declaring `int x` means x can only ever hold whole numbers. Primitive variables hold the value itself, while object variables hold a [reference](/ap-comp-sci-a/key-terms/reference "fv-autolink"), which is why copying an int copies the number but copying an ArrayList copies the address.

### Typecasting (Unit 1)

Casting converts between primitive types. Java widens int to double automatically, but going the other way requires an explicit cast like `(int) 3.9`, which truncates to 3 (it does not round). The classic exam trick is fixing [integer division](/ap-comp-sci-a/key-terms/integer-division "fv-autolink") by casting first, since `(double) 7 / 2` gives 3.5 but `(double) (7 / 2)` gives 3.0.

### Arithmetic Operators (Unit 1)

How +, -, *, /, and % behave depends entirely on the primitive types involved. Two ints divided give an int with the decimal chopped off, and mixing an int with a double promotes the result to double. The [modulo operator](/ap-comp-sci-a/key-terms/modulo-operator "fv-autolink") % only makes intuitive sense once you understand int arithmetic.

### [Import Statement (Unit 1)](/ap-comp-sci-a/key-terms/import-statement)

A nice contrast that clarifies what primitives are. Classes like Scanner or ArrayList live in packages and may need importing, but primitives are baked into the Java language itself. You never import int, double, or boolean.

## On the AP Exam

Primitives are everywhere on the exam even when the question isn't 'about' them. MCQs love expression-evaluation traps: integer division (`5 / 2` is 2), mixed int/double arithmetic, truncation from casting, and modulo results. You'll also see questions where choosing the wrong return type or comparison breaks the logic. On FRQs, you're expected to pick the right primitive type without being told: int for counters and indices, double for averages and prices, boolean for flags and return values of methods like `isValid`. A super common FRQ point-loser is computing an average with int division, like `sum / count` when both are ints, and silently dropping the decimal. Declaring types correctly and handling int vs. double arithmetic is free points if you're careful.

## Primitives vs Reference types (objects)

Primitives store the value itself; reference types store a memory address pointing to an object. Practical fallout: primitives have no methods (no dot notation), `==` compares primitive values directly but compares addresses for objects (use .equals() for Strings), and the default for an unassigned object is null while primitives can never be null. String looks primitive because it has literal syntax, but it's an object.

## Key Takeaways

- The AP CSA exam tests exactly three primitive types: int for whole numbers, double for decimals, and boolean for true or false.
- Primitives store values directly and have no methods, while reference types like String and ArrayList store addresses pointing to objects.
- Dividing two ints gives an int and throws away the decimal, so 7 / 2 equals 3, not 3.5.
- Casting a double to an int truncates toward zero, so (int) 3.9 is 3, and casting one operand to double before dividing is the standard fix for integer division.
- Use == to compare primitives, but use .equals() to compare objects like Strings, because == on objects compares references, not contents.
- String is not a primitive, even though it has literal syntax like "hello"; it's a class, which is why it has methods like .length() and .substring().

## FAQs

### What are primitives in AP Computer Science A?

Primitives are Java's basic built-in data types that store values directly rather than as objects. The AP CSA exam covers three: int (whole numbers), double (decimals), and boolean (true/false), all introduced in Unit 1.

### Is String a primitive type in Java?

No. String is a class, which makes it a reference type. That's why Strings have methods like .length() and why you compare them with .equals() instead of ==. The literal syntax ("hello") makes it look primitive, but it isn't.

### How are primitives different from objects in Java?

A primitive variable holds the actual value (like 42), while an object variable holds a reference to where the object lives in memory. Primitives have no methods and can never be null; objects have methods and can be null.

### Why does 7 / 2 equal 3 in Java instead of 3.5?

Because both operands are ints, Java performs integer division and truncates the decimal. To get 3.5, make at least one operand a double, for example (double) 7 / 2 or 7 / 2.0. This trap shows up constantly on MCQs and average-computing FRQs.

### Do I need to know all eight Java primitive types for the AP exam?

No. Java has eight primitives (including byte, short, long, float, and char), but the AP CSA course subset only tests int, double, and boolean. Knowing those three deeply matters far more than memorizing the rest.

## Structured Data

```json
{"@context":"https://schema.org","@graph":[{"@type":"LearningResource","@id":"https://fiveable.me/ap-comp-sci-a/key-terms/primitives#resource","name":"Primitives — AP Comp Sci A Definition & Exam Guide","url":"https://fiveable.me/ap-comp-sci-a/key-terms/primitives","learningResourceType":"Concept explainer","educationalLevel":"AP / High School","about":{"@id":"https://fiveable.me/ap-comp-sci-a/key-terms/primitives#term"},"audience":{"@type":"EducationalAudience","educationalRole":"student"},"dateModified":"2026-06-12T23:22:05.110Z","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/primitives#term","name":"Primitives","description":"Primitives are Java's built-in basic data types that store simple values directly in memory. On AP CSA you work with three of them: int (whole numbers), double (decimals), and boolean (true/false). Unlike objects, primitives have no methods and you never call new to create them.","url":"https://fiveable.me/ap-comp-sci-a/key-terms/primitives","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 are primitives in AP Computer Science A?","acceptedAnswer":{"@type":"Answer","text":"Primitives are Java's basic built-in data types that store values directly rather than as objects. The AP CSA exam covers three: int (whole numbers), double (decimals), and boolean (true/false), all introduced in Unit 1."}},{"@type":"Question","name":"Is String a primitive type in Java?","acceptedAnswer":{"@type":"Answer","text":"No. String is a class, which makes it a reference type. That's why Strings have methods like .length() and why you compare them with .equals() instead of ==. The literal syntax (\"hello\") makes it look primitive, but it isn't."}},{"@type":"Question","name":"How are primitives different from objects in Java?","acceptedAnswer":{"@type":"Answer","text":"A primitive variable holds the actual value (like 42), while an object variable holds a reference to where the object lives in memory. Primitives have no methods and can never be null; objects have methods and can be null."}},{"@type":"Question","name":"Why does 7 / 2 equal 3 in Java instead of 3.5?","acceptedAnswer":{"@type":"Answer","text":"Because both operands are ints, Java performs integer division and truncates the decimal. To get 3.5, make at least one operand a double, for example (double) 7 / 2 or 7 / 2.0. This trap shows up constantly on MCQs and average-computing FRQs."}},{"@type":"Question","name":"Do I need to know all eight Java primitive types for the AP exam?","acceptedAnswer":{"@type":"Answer","text":"No. Java has eight primitives (including byte, short, long, float, and char), but the AP CSA course subset only tests int, double, and boolean. Knowing those three deeply matters far more than memorizing the rest."}}]},{"@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":"Primitives"}]}]}
```
