Online Java Compiler By
JavaTpoint.com
public class JavaCharacterforDigitExample1 { public static void main(String[] args) { int a1 = 5; int a2 = 6; char ch1 = Character.forDigit(a1, 10); char ch2 = Character.forDigit(a2, 16); String str1 = "The char representation of " + a1 + " in radix 10 is " + ch1; String str2 = "The char representation of " + a2 + " in radix 16 is " + ch2; System.out.println( str1); System.out.println( str2 ); } }
Output