This should emend your code
private static void expresion() throws IOException, ParseException{
int a = firstdigit - '0';
int b = seconddigit - '0';
sum = (a+b);
System.out.println(firstdigit + " "+ seconddigit );
System.out.println(sum);
}
Anyway I warmly encourage your to
- Don't mix
char
s and int
s (that is directly gather integers from user input). - Don't use the same name for methods and variables (that's rather confusing).