What happens FIRST when the following statement executes?
value = 2*3 ;
FIRST, do the multiplication 2*3 to get the value 6.
FIRST, do the multiplication 2*3 to get the value 6.
NEXT, put the result of the calculation into
the "litte box of memory" used for the variable value
:
It will really, really help you to think carefully about these two steps. Sometimes even second year computer science majors get confused about this and write buggy code.
What will this program fragment write?
value = 2*3; System.out.println( "value holds: " + value );