Java - toString() Method


Advertisements


Description

This method returns a String object representing the specified character value, that is, a one-character string.

Syntax

String toString(char ch)

Parameters

Here is the detail of parameters −

  • ch − Primitive character type.

Return Value

  • This method returns String object.

Example

Live Demo
public class Test {

   public static void main(String args[]) {
      System.out.println(Character.toString('c'));
      System.out.println(Character.toString('C'));
   }
}

This will produce the following result −

Output

c
C

java_characters.htm

Advertisements