Short answer
char is an unsigned 16-bit UTF-16 code unit, so it participates in arithmetic and 'A' + 1 yields 66.
Explanation
The trap is that characters outside the Basic Multilingual Plane (emoji, many CJK extensions) are encoded as surrogate pairs spanning two chars, so str.length() and charAt() count code units, not code points. For correct counting or iteration use codePointCount, codePoints(), or String methods that are code-point aware.
Common mistakes
- Treating String.length() as the number of visible characters for emoji or non-BMP text.
- Splitting strings by char and breaking surrogate pairs; use code points.