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

Answer:

No, because double uses 64 bits, the equivalent of about 15 decimal digits of precision.


Unsafe Conversions

NO Automatic Conversion
  • Converting from an integer type to another integer type with fewer bits.
  • Converting from a floating point type to another floating point type with fewer bits.
  • Converting from a floating point type to any integer type will possibly lose both precision and magnitude.
  • Conversion to or from boolean is never allowed (not even with a type cast.)

Unsafe conversions are not automatically performed, as shown in the above table.

Remember the sizes of the various primitive numeric types.

typenumber of bits
byte8
short16
int32
long64
float32
double64


QUESTION 8:

Click the correct button for the following type conversions. There is only one correct answer per row.

conversion No information lost.

Automatic Conversion.
Possible loss of precision.

Automatic Conversion.
Possible great loss of information.

Requires a Type Cast.
byte to short
short to byte
short to long
int to float
float to byte
double to float