To my understanding a char is a single character, that is a letter, a digit, a punctuation mark, a tab, a space or something similar. And therefore when I do:
You end up with out of 50 because you have told Java to treat the result of the addition as an int in the following line:
50
int
int ans = a + c;
Instead of int you declare ans as a char.
ans
char
Like so:
final int a = 1; final char c = '1'; final char ans = (char) (a + c); System.out.println(ans);