Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Java toString() Method

Java toString() Method

Java Character ClassJava 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 char.

Syntax



String toString(char ch)

Parameters

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 Class