Java String Conversions

by Dan Bunker

 

String Conversion Methods

You can convert other objects into a String data type by utilizing the valueOf() and toString() methods. The valueOf() method will convert the basic Java primitive data types into a string representation. This method is also static and can be used on the String class without having to construct one first. The toString() method is defined on the base Java Object class and most all other Java objects have overridden the toString() and have provided a way to get that object to convert to a String representation of that object.