Java Character toString() Method Tutorial

In this section, we will learn what the Character toString() method is and how to use in Java.

What is Java Character toString() Method?

The `toString()` method is used to take a character value and return a String object that represents that character.

Java toString() Method Syntax:

static String toString(char ch)

toString() Method Parameters:

The method takes one argument, and that is the character value we want to cast it into a string object.

toString() Method Return Value:

The return value of this method is a string object that contains the character we’ve set as the argument of the method.

Example: using Character toString() method

public class Simple {

    public static void main(String args[]) {

       String res = Character.toString('c');
        System.out.println(res);
    }
}

Output:

C

Leave a Reply