August 2004
Intermediate to advanced
480 pages
9h 41m
English
Now that it is clearer how Strings assignments and concatenation work, we will turn our attention to performing miscellaneous but frequently useful String operations.
In this section we'll look at a couple of ways to convert different kinds of things into Strings.
Often you need to convert certain types to Strings in order to pass them to a method that accepts only a String. You can do this using the valueOf() method of the String class.
System.out.println(String.valueOf(Math.PI)); //prints 3.141592653589793
There are several valueOf() methods defined for the String class, each of which takes different parameters (which means that the valueOf() method is overloaded ...
Read now
Unlock full access