java tutorial - Java - Method Character.toString() - java programming - learn java - java basics - java for beginners



Description

Java - Method Character.toString() — The Character.toString () method returns a string object (String) and represents the specified char value as a single character string.

Syntax

String toString(char ch)
click below button to copy the code. By - java tutorial - team

Options

Detailed information about the parameters:

  • ch is a primitive character type (char).

Return value

  • In Java, Character.toString () returns a string object.

Sample Code

public class Test{

   public static void main(String args[]){
      System.out.println("Value \"" + Character.toString('Q') + "\" is a string object.");
      System.out.println("Value \"" + Character.toString('S') + "\" is a string object.");
   }
}
click below button to copy the code. By - java tutorial - team

Output

Value "Q" is a string object.
Value "S" is a string object.

Related Searches to Java - Method Character.toString()