HOME      BLOG       FORUMS      CONTACT       ABOUT

Convert primitive character value to String object.

The toString method of Character class is used for converting a primitive character value to a String object.

public class CharWrapper {
	public static void main(String[] args) {
		char c = 'a';
		String value = Character.toString(c);
		System.out.println(value);
	}
}

or

public class CharWrapper {
	public static void main(String[] args) {
		char c = 'a';
		Character objChar = new Character(c);
		String value = objChar.toString();
		System.out.println(value);
	}
}

Share

Tags: , , , , ,


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

Leave a Reply