1public class JavaExample{
2 public static void main(String args[]){
3 char ch = '9';
4
5 /* Since parseInt() method of Integer class accepts
6 * String argument only, we must need to convert
7 * the char to String first using the String.valueOf()
8 * method and then we pass the String to the parseInt()
9 * method to convert the char to int
10 */
11 int num = Integer.parseInt(String.valueOf(ch));
12
13 System.out.println(num);
14 }
15}
1char something = '1';
2int value = Integer.parseInt(something + "");
3System.out.println(value); // prints 1