Java - toString() Method

Advertisements


Description:

The 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:

public class Test{

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

This produces the following result:

c
C



Advertisements
Advertisements