Online Java Compiler By
JavaTpoint.com
public class JavaCharacterToStringExample2 { public static void main(String[] args) { // Create two Character objects c1 and c2. Character c1, c2; // Assign the values to c1 and c2. c1 = new Character('A'); c2 = new Character('7'); // Create two String objects s1 and s2. String s1, s2; // Assign the String values of c1 and c2 to s1 and s2 respectively. s1 = c1.toString(); s2 = c2.toString(); // Print the values of str1 and str2. System.out.println("The string value of " + c1 + " is: " + s1); System.out.println("The string value of " + c2 + " is: " + s2); } }
Output