Java String valueOf()

The java string valueOf() method converts different types of values into string. By the help of string valueOf() method, you can convert int to string, long to string, boolean to string, character to string, float to string, double to string, object to string and char array to string.


Internal implementation


Signature

The signature or syntax of string valueOf() method is given below:


Returns

string representation of given value


Java String valueOf() method example

Test it Now

Output:

3010

Java String valueOf(boolean bol) Method Example

This is a boolean version of overloaded valueOf() method. It takes boolean value and returns a string. Let's see an example.

Test it Now

Output:

true
false

Java String valueOf(char ch) Method Example

This is a char version of overloaded valueOf() method. It takes char value and returns a string. Let's see an example.

Test it Now

Output:

A
B

Java String valueOf(float f) and valueOf(double d)

This is a float version of overloaded valueOf() method. It takes float value and returns a string. Let's see an example.

Test it Now

Output:

10.05
10.02

Java String valueOf() Complete Examples

Let's see an example where we are converting all primitives and objects into strings.

Test it Now

Output:

true
11
12
13
14
15.5
16.5
java
StringValueOfExample5@2a139a55
Next TopicJava Regex




Contact US

Email:[email protected]

String valueOf()
10/30