AP® Computer Science A glossary
Expression
Also called: arithmetic expression
Course: AP® Computer Science A Shows up in: Unit 1: Using Objects and Methods
Code that is evaluated to a single value with a type. An arithmetic expression combines numeric values, variables and operators.
Appears in the course and exam description (CED): 1.3.C.11.4.A.3
An expression produces a value: a + 4. A statement is a complete instruction ending in ;: int b = a + 4;. An arithmetic expression, made of numeric values, variables and operators, has type int or double.
int a = 6;
double half = a / 4.0;
System.out.println(a + 4);
System.out.println(half);
Output:
10
1.5 Learn it properly, with a checkpoint 1.3 Expressions and Output