O'Reilly logo

Java, A Beginner’s Guide, 5th Edition by Herbert Schildt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Java’s Type Wrappers to Convert Numeric Strings

Before leaving the topic of I/O, we will examine a technique useful when reading numeric strings. As you know, Java’s println( ) method provides a convenient way to output various types of data to the console, including numeric values of the built-in types, such as int and double. Thus, println( ) automatically converts numeric values into their human-readable form. However, methods like read( ) do not provide a parallel functionality that reads and converts a string containing a numeric value into its internal, binary format. For example, there is no version of read( ) that reads a string such as “100” and then automatically converts it into its corresponding binary value that is able to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required