Write a Java Program to Convert Character to String and Vice-Versa

Write a Java Program to Convert Character to String and Vice-Versa

public class CharString {

    public static void main(String[] args) {
        char ch = 'c';
        String st = Character.toString(ch);
        // Alternatively
        // st = String.valueOf(ch);

        System.out.println("The string is: " + st);
    }
}

Final output

Leave a Comment