Incrementing Char Type In Java

前端 未结 10 1588
鱼传尺愫
鱼传尺愫 2020-12-03 05:08

While practicing Java I randomly came up with this:

class test
{
    public static void main(String arg[])
    {
        char x=\'A\';
        x=x+1;
                


        
10条回答
  •  一向
    一向 (楼主)
    2020-12-03 05:16

    Each char has a character code. The computer sees a character as an unsigned number, so you can increment it.

提交回复
热议问题