---
title: "Arithmetic Expression — AP CSA Definition & Exam Guide"
description: "An arithmetic expression combines numeric values, variables, and operators (+, -, *, /, %) to produce an int or double. Master int vs double rules for Unit 1."
canonical: "https://fiveable.me/ap-comp-sci-a/key-terms/arithmetic-expression"
type: "key-term"
subject: "AP Computer Science A"
unit: "Unit 1"
---

# Arithmetic Expression — AP CSA Definition & Exam Guide

## Definition

In AP Computer Science A, an arithmetic expression is code made of numeric values, variables, and the operators +, -, *, /, and % that evaluates to a single numeric result; two int operands produce an int, while at least one double operand produces a double (EK 1.3.C.2).

## What It Is

An arithmetic expression is any piece of Java code that combines [numeric values](/ap-comp-sci-a/unit-1/expressions-and-assignment-statements/study-guide/01dr6uUPDAn3SjtK2Psr "fv-autolink"), variables, and arithmetic operators to produce one numeric answer. Per EK 1.3.C.1 and 1.3.C.2, the five operators on the AP exam are addition `+`, subtraction `-`, multiplication `*`, division `/`, and remainder `%`. Something like `x * 2 + 1` or `total / count` is an arithmetic expression.

The part the exam actually tests is the *type* of the result. The rule is simple but unforgiving. If both operands are `int`, the result is an `int`. If at least one operand is a `double`, the result is a `double`. That one rule explains why `5 / 2` gives `2` ([integer division](/ap-comp-sci-a/key-terms/integer-division "fv-autolink") throws away the decimal portion, per EK 1.3.C.3) while `5.0 / 2` gives `2.5`. One single `.0` changes the entire answer.

## Why It Matters

Arithmetic expressions live in Topic 1.3 (Expressions and Assignment Statements) under learning objective 1.3.C, which asks you to develop code for arithmetic expressions and determine their results. They extend directly into [Topic 1.5](/ap-comp-sci-a/unit-1/casting-and-ranges-of-variables/study-guide/kW3XXEIwJwVRXFx3ntdC "fv-autolink"), where LO 1.5.A adds casting with `(int)` and `(double)`, LO 1.5.B covers what happens when an int [expression](/ap-comp-sci-a/key-terms/expression "fv-autolink") overflows past `Integer.MAX_VALUE`, and LO 1.5.C covers round-off errors with doubles. This is foundation-level material. Every loop counter, every average calculation, and every method you write for the rest of the course (and on FRQs) is built out of arithmetic expressions, so the int/double evaluation rules follow you through all four units.

## Connections

### [Integer division (Unit 1)](/ap-comp-sci-a/key-terms/integer-division)

Integer division is the single most-tested consequence of the arithmetic expression type rules. When both operands are ints, `/` keeps only the whole-number part of the quotient, so `7 / 2` is `3`, not `3.5`. If a multiple-choice answer looks 'off by the decimal,' integer division is usually the trap.

### [Cast operator (Unit 1)](/ap-comp-sci-a/key-terms/cast-operator)

Casting is how you override the default type rules inside an arithmetic expression. Writing `(double) x / y` converts `x` to a double before dividing, which forces real division. Placement matters, since `(double)(x / y)` divides as ints first and casts the already-truncated answer.

### [Remainder operator (Unit 1)](/ap-comp-sci-a/key-terms/remainder-operator)

The `%` operator is one of the five arithmetic operators and returns what's left over after division. It powers classic AP [patterns](/ap-comp-sci-a/unit-1/why-programming-why-java/study-guide/lVK6rmrBuug17i1Hna9z "fv-autolink") like checking evenness with `x % 2 == 0` and pulling digits off a number, so treat it as a first-class citizen, not an afterthought.

### [Round-off error (Unit 1)](/ap-comp-sci-a/key-terms/round-off-error)

Arithmetic expressions with doubles can produce results too precise for memory to hold, causing round-off errors (EK 1.5.C.1). The CED's advice is blunt. When exactness matters, use int values. Int expressions have their own failure mode, integer overflow, when results exceed Integer.MAX_VALUE.

## On the AP Exam

Arithmetic expressions show up constantly in 'what is printed?' multiple-choice questions, and the questions are engineered around the int/double rules. A typical stem mixes arithmetic with `System.out.print`: for example, evaluating `vals[0] + x / y` where `x = 5` and `y = 2`. Since `x / y` is int division, it gives `2`, and the result is `7.0`, while `vals[1] + (double) x / y` gives `9.5` because the cast forces real division. Another classic trap mixes `+` with strings, where `System.out.print(x + y + " ")` adds first (printing `7 `) because evaluation runs left to right. On FRQs, you won't be asked to define the term, but nearly every method you write uses arithmetic expressions, and graders deduct points for integer division mistakes in averages and percentage calculations.

## arithmetic expression vs String concatenation with +

The `+` symbol does two different jobs in Java. Between two numeric values it's arithmetic addition, but if either operand is a String, it becomes concatenation. So `5 + 2 + " "` prints `7 ` (addition happens first, left to right), while `" " + 5 + 2` prints ` 52` because once a String enters the expression, everything after it gets glued on as text. Exam questions love putting the String in different positions to test exactly this.

## Key Takeaways

- An arithmetic expression combines numeric values, variables, and the operators +, -, *, /, and % to produce a single int or double result.
- If both operands are ints, the result is an int; if at least one operand is a double, the result is a double.
- Dividing two int values keeps only the integer portion of the quotient, so 7 / 2 evaluates to 3, not 3.5.
- Casting with (double) before division forces real division, but only if the cast happens before the divide, not after.
- An int expression that goes past Integer.MAX_VALUE causes integer overflow, and an overly precise double result causes a round-off error.
- When + touches a String anywhere in the expression, evaluation switches from addition to concatenation from that point onward.

## FAQs

### What is an arithmetic expression in AP Computer Science A?

It's code built from numeric values, variables, and the operators +, -, *, /, and % that evaluates to one numeric result of type int or double. It's covered in Topic 1.3 under learning objective 1.3.C.

### Does 5 / 2 equal 2.5 in Java?

No. Both 5 and 2 are int values, so Java performs integer division and keeps only the whole-number part, giving 2. You'd need 5.0 / 2, 5 / 2.0, or a cast like (double) 5 / 2 to get 2.5.

### How is an arithmetic expression different from string concatenation?

Both can use the + symbol, but arithmetic addition only happens when both operands are numeric. The moment a String appears, + switches to [concatenation](/ap-comp-sci-a/unit-1/string-methods/study-guide/SltCtk8JxBIgHcMfG6G4 "fv-autolink"), so 5 + 2 + "!" prints 7! while "!" + 5 + 2 prints !52.

### What happens if an arithmetic expression is too big for an int?

Integer overflow occurs (EK 1.5.B.3). Java ints are stored in 4 bytes, so any result outside the range from Integer.MIN_VALUE to Integer.MAX_VALUE wraps to an in-range value that is not mathematically correct.

### Is the remainder operator % an arithmetic operator on the AP exam?

Yes. EK 1.3.C.2 lists exactly five arithmetic operators: +, -, *, /, and %. The [remainder operator](/ap-comp-sci-a/key-terms/remainder-operator "fv-autolink") follows the same type rules as the others and shows up often in even/odd checks and digit extraction.

## Related Study Guides

- [1.3 Expressions and Assignment Statements](/ap-comp-sci-a/unit-1/expressions-and-assignment-statements/study-guide/01dr6uUPDAn3SjtK2Psr)

## Structured Data

```json
{"@context":"https://schema.org","@graph":[{"@type":"LearningResource","@id":"https://fiveable.me/ap-comp-sci-a/key-terms/arithmetic-expression#resource","name":"Arithmetic Expression — AP CSA Definition & Exam Guide","url":"https://fiveable.me/ap-comp-sci-a/key-terms/arithmetic-expression","learningResourceType":"Concept explainer","educationalLevel":"AP® / High School","about":{"@id":"https://fiveable.me/ap-comp-sci-a/key-terms/arithmetic-expression#term"},"audience":{"@type":"EducationalAudience","educationalRole":"student"},"dateModified":"2026-06-11T05:27:19.823Z","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/arithmetic-expression#term","name":"arithmetic expression","description":"In AP Computer Science A, an arithmetic expression is code made of numeric values, variables, and the operators +, -, *, /, and % that evaluates to a single numeric result; two int operands produce an int, while at least one double operand produces a double (EK 1.3.C.2).","url":"https://fiveable.me/ap-comp-sci-a/key-terms/arithmetic-expression","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 arithmetic expression in AP Computer Science A?","acceptedAnswer":{"@type":"Answer","text":"It's code built from numeric values, variables, and the operators +, -, *, /, and % that evaluates to one numeric result of type int or double. It's covered in Topic 1.3 under learning objective 1.3.C."}},{"@type":"Question","name":"Does 5 / 2 equal 2.5 in Java?","acceptedAnswer":{"@type":"Answer","text":"No. Both 5 and 2 are int values, so Java performs integer division and keeps only the whole-number part, giving 2. You'd need 5.0 / 2, 5 / 2.0, or a cast like (double) 5 / 2 to get 2.5."}},{"@type":"Question","name":"How is an arithmetic expression different from string concatenation?","acceptedAnswer":{"@type":"Answer","text":"Both can use the + symbol, but arithmetic addition only happens when both operands are numeric. The moment a String appears, + switches to [concatenation](/ap-comp-sci-a/unit-1/string-methods/study-guide/SltCtk8JxBIgHcMfG6G4 \"fv-autolink\"), so 5 + 2 + \"!\" prints 7! while \"!\" + 5 + 2 prints !52."}},{"@type":"Question","name":"What happens if an arithmetic expression is too big for an int?","acceptedAnswer":{"@type":"Answer","text":"Integer overflow occurs (EK 1.5.B.3). Java ints are stored in 4 bytes, so any result outside the range from Integer.MIN_VALUE to Integer.MAX_VALUE wraps to an in-range value that is not mathematically correct."}},{"@type":"Question","name":"Is the remainder operator % an arithmetic operator on the AP exam?","acceptedAnswer":{"@type":"Answer","text":"Yes. EK 1.3.C.2 lists exactly five arithmetic operators: +, -, *, /, and %. The [remainder operator](/ap-comp-sci-a/key-terms/remainder-operator \"fv-autolink\") follows the same type rules as the others and shows up often in even/odd checks and digit extraction."}}]},{"@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":"Unit 1","item":"https://fiveable.me/ap-comp-sci-a/unit-1"},{"@type":"ListItem","position":4,"name":"arithmetic expression"}]}]}
```
