Incrementing Char Type In Java

In Java, char is a numeric type. When you add 1 to a char, you get to the next unicode code point. In case of 'A', the next code point is 'B':

char x='A';

Note that you cannot use x=x+1 because it causes an implicit narrowing conversion. You need to use either x++ or x+=1 instead.

Leave a Comment