Online Java Compiler By
JavaTpoint.com
public class JavaCharactertoUpperCaseExample_2 { public static void main(String[] args) { // Initialize two char primitives. int codepoint1 = 119; int codepoint2 = 80; // Convert the codepoints to char type. char ch1 = (char) codepoint1; char ch2 = (char) codepoint2; // Convert the codepoints to uppercase. char upper1 = Character.toUpperCase(ch1); char upper2 = Character.toUpperCase(ch2); // Print the result. String str1 = "The uppercase for the character '" + ch1 + "' is given as: " + upper1; String str2 = "The uppercase for the character '" + ch2 + "' is given as: " + upper2; System.out.println(str1); System.out.println(str2); } }
Output