import java.util.Scanner; public class CharDemo { public static void main(String[] args) { char ch = '\n'; int code; ch = '7'; code = ch - '0'; System.out.printf("'%c' - '0' = %d\n", ch, code); ch = 'd'; code = ch - 'a'; System.out.printf("'%c' is %d from a\n",ch, code); } }