Arithmetic on char operands promotes both to int, so 'A' + 'B' produces an int, not a char; getting a char result back requires an explicit cast.
char c = 'A';
char next = (char) (c + 1);
int sum = 'A' + 'B';
System.out.println("'A' + 1 as char = " + next);
System.out.println("'A' + 'B' as int = " + sum);
'A' + 1 as char = B
'A' + 'B' as int = 131
Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.
Published 2026-09-27