Note that the number stored in the nval
instance variable is always
a floating-point double
value, even if what you see in the file is
an integer. The rationale is that you can always cast a double
value into any other type. Accordingly, if your file contains integers,
and you want to work with int
values, you need to cast the number that
you obtain from the nval
instance variable:
(int) tokens.nval