How to use Character.toString() Method In Java

We can convert a char to a string object in Java by using the  Character.toString() method of Character class.

Below is the Java implementation of the above method:

Java




// Java Program to Convert Char to String
// Using toString() method of Character class
  
// Importing the required packages
import java.io.*;
import java.util.*;
  
// Main class
class GFG {
    // Main driver method
    public static void main(String[] args)
    {
        // Declaring a char variable
        char c = 'G';
  
        // Converting the char to String using toString
        // method of Character class and storing it in a
        // string
        String s = Character.toString(c);
  
        // Print and display the above string
        System.out.println(
            "Char to String using Character.toString():"
            + " " + s);
    }
}


Output

Char to String using Character.toString method : G

How to Convert Char to String in Java?

In this article, we will learn how to Convert Char to String in Java. If we have a char value like ‘G’ and we want to convert it into an equivalent String like “G” then we can do this by using any of the following three listed methods in Java.

  1. Using toString() method of Character class
  2. Using valueOf() method of the String class
  3. Using concatenation of strings

Example of Conversion of Char to String Java

Input  : 'G'   // Character
Output : "G"  // String

Similar Reads

Methods to Convert Char to String

Let’s discuss three methods in detail for Convert Char to String in Java:...

1. Using Character.toString() Method

We can convert a char to a string object in Java by using the  Character.toString() method of Character class....

2. Using valueOf() method

...

3. Java char to String Example: Using Concatenation of Strings

We can convert a char to a string object in Java by using String.valueOf() method of String Class....

Java char to String: Other Examples

...