How to Convert char to String

String and Character classes from java.lang package provide methods to convert a primitive character to String.

String.valueOf(char)

package com.techstackjournal;

public class CharToString {

	public static void main(String[] args) {

		char chr = 'a';
		String strChr = String.valueOf(chr);
		System.out.println(strChr);

	}

}
// Output
a

Character.toString(char)

package com.techstackjournal;

public class CharToString {

	public static void main(String[] args) {

		char chr = 'a';
		String strChr = Character.toString(chr);
		System.out.println(strChr);

	}

}
// Output
a
See also  How to split a String in Java