AP® Computer Science A glossary

Variable

Course: AP® Computer Science A Shows up in: Unit 1: Using Objects and Methods

A named storage location that holds a value, which can change while the program runs. Every variable has a name and a data type.

Appears in the course and exam description (CED): 1.2.B.2

A variable has a name, such as score, and a data type, such as int. Its value can change, but its name and type cannot. A variable of a primitive type holds a primitive value of that type.

int score = 10;
score = 15;
System.out.println(score);

Output:

15
Learn it properly, with a checkpoint 1.2 Variables and Data Types

Related terms

Was this page helpful?

No names are ever shown, and every public comment is checked by us first. Please do not include personal details. To get a reply, email [email protected].

↑ Top

Enlarged view of the selected figure