How to Convert Numbers to Strings, etc.

Static methods returning Strings:

String.valueOf(int)
String.valueOf(double)

etc.

e.g.

   might not be "3.14159" due to digits from converstion

 

To convert Strings to primitive number types (int, float, double, ...)

 

Integer.parseInt(String, int radix)

returns numeric value in given radix.

 

See converter.java  for example,

which also illustrates

StreamTokenizer
Exceptions

 

To Next Slide To Previous Slide To Contents