The the difficulties with string to numerical conversion and formatting of numerical output that were part of Java 1.0 are no longer nearly so bad in 1.1 Horstmann & Cornell, however, already had a book of examples using their Format class so they didn't bother to change. Although you could of course simply include the Format class in all your programs this strikes me as sloppy and inappropriate now that the capabilities are there within the language. (Note also that J++ users will need to go out of their way to import this class and get it in their CLASSPATH)

The features added in 1.1 are primarily the improved "Reader & BufferedReader and Writer & Buffered Writer classes which assiste input & output streams in getting conversions, formatting, etc. done correctly. IMHO the greatest problem with the earlier libraries was the absence of something like scanf or fscanf to get easy string to number conversions. Below is a code example using some of these class library objects which opens a socket, reads from it converting the bytes it gets to a float, then writes the value of that float back through the socket as a string.

On the read side of these conversions a BufferedReader object is created to read from the InputStreamReader which was returned by the getInputStream method of the Socket incoming. The doubleValue method defines the value assigned to answ while the valueOf method of the Double object performs the conversion of the bytes returned by the readLine method of the BufferedReader in. The trim method is called for readLine to get rid of trailing blanks which would otherwise corrupt the conversion.

Output is much easier and depends simply on the valueOf conversion of the String object.

  Socket incoming;
       PrintWriter out = new PrintWriter(incoming.getOutputStream(),true);
       BufferedReader in = new BufferedReader(new InputStreamReader
                           (incoming.getInputStream()));
      answ = Double.valueOf(in.readLine().trim()).doubleValue();
      out.println(String.valueOf(answ));