created 02/15/98; revised: 07/31/99; 01/18/00; 06/01/00

CHAPTER 11 --- Floating-point Input and Output

Floating point input using java.io is fundamentally like integer input. With floating point, as with integers, you first read in characters. Then, if the characters are correctly formatted, they are converted to a numeric type.

Chapter Topics:

  • Converting strings to double.
  • Keyboard input of floting point numbers.
  • Fill-in-the-blank Story Problems.

The methods in this chapter work only with Java versions 1.2 and higher. If you have an earlier version of Java you can skip this chapter without significant loss.

QUESTION 1:

Both int and float are 32 bits. Is the pattern in the int value 221 the same pattern as in the float value 221.0?

Click Here after you have answered the question