Online Java Compiler By
JavaTpoint.com
public class JavaCharacterDigitExample3 { public static void main(String args[]) { // Initialize the array char a[] = { 'a', 'b', 'c', 'd' }; // Create the object obj Character obj = new Character('a'); int digit = obj.digit(3, 6); System.out.println("The numerical value for the alphabets:'a', 'b', 'c', 'd' is given as "+digit); char char1 = '5'; int store = Character.digit(char1, 6); System.out.println("The numeric value of " + char1 + " in radix 4 is: "+store); } }
Output