AP® Computer Science A glossary
Assignment statement
Also called: assignment operator, =
Course: AP® Computer Science A Shows up in: Unit 1: Using Objects and Methods
A statement that uses = to store the value of the expression on the right in the variable on the left.
Appears in the course and exam description (CED): 1.4.A.2
The assignment operator = initializes or changes the value stored in a variable. Java evaluates the right side first with the current values, then stores the result, so c = c + 1; adds 1 to c.
int c = 4;
c = c + 1;
System.out.println(c);
Output:
5 Learn it properly, with a checkpoint 1.4 Assignment Statements and Input