value holds: 6
Here is another program fragment:
int extra; extra = 5;
The assignment statement is correct. It matches the syntax:
variableName = expression;
The
expression is the literal 5
.
No calculation needs to be done.
But the assignment statement still takes two steps.
FIRST, get the 5:
NEXT, put the 5 in the variable:
What does the following fragment write?
int quantity = 7; quantity = 13; System.out.println( "quantity holds: " + quantity );