Write a Java Program to convert char type variables to int
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
class Main { public static void main(String[] args) { // create char variables char a = '5'; char b = 'c'; // convert char variables to int // ASCII value of characters is assigned int num1 = a; int num2 = b; // print the values System.out.println(num1); // 53 System.out.println(num2); // 99 } } |