Java toString() method


Java  Character类Java Character Class


The toString() method is used to return a String object representing the specified char value. The result is a string of length 1 consisting only of the specified chars.

Syntax

String toString(char ch)

Parameters

  • ch -- The characters to be converted.

Return value

Returns the string representation of the specified char value.

Example

public class Test {public static void main(String args[]) {System.out.println(Character.toString('a'));System.out.println(Character.toString('A'));}}

The execution result of the above program is:

a
A

##Java Character classJava  Character类