go to previous page   go to home page   go to next page hear noise highlighting

Answer:

value holds: 6

More Practice

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:

Do First

NEXT, put the 5 in the variable:

Do Second

QUESTION 14:

What does the following fragment write?

int quantity = 7;

quantity = 13;
System.out.println( "quantity holds: " + quantity );

go to previous page   go to home page   go to next page