The assembler will not catch this mistake, and the program will run to completion. However, the second print method call writes an incorrect value to the screen.
This
type of mistake often happens when
programming in "C" where type checking is weak.
Sometimes the wrong type can be passed to a
function (such as printf
) and odd
things happen.
Here is the output of the program:
Compilers that keep track of the data types of values and that make sure that the correct types are used as arguments do strong type checking. Java is strongly typed. In assembly language type checking is largely absent.
The first line of output shows the 32 bits interpretted as a single precision floating point value. Is this output correct? (Hint: look at the program on the previous page).