Java Character toString() Method

The toString() method of Character class returns the String object which represents the given Character's value. The obtained result is typically a string with length 1 whose component is a primitive char value that represents the Character object.

Syntax

Return Value

The toString()method returns the string representation of the given character.

Example 1

Output:

The string value of r is: r
The string value of 9 is: 9

Example 2

Output:

The string value of A is: A
The string value of 7 is: 7

Java Character toString(char c)Method

The toString(char c) method of Character class returns the String object which represents the given Character's value. The obtained result is typically a string with length 1 whose component is a primitive char value that represents the Character object.

Syntax

Parameter

c: It is the character that needs to be tested.

Return Value

The toString(char c) method returns the string representation of the given character.

Example 1

Output:

The string value of V is given as:V
The string value of v is given as: v

Example 2

Output:

The string value of f is given as:f
The string value of e is given as: e