char ch='A'; System.out.println(ch); //prints A ch++; System.out.println(ch); //prints B ch='0'; System.out.println(ch); //prints 0 ch++; System.out.println(ch); //prints 1 ch='9'; System.out.println(ch); //prints 9 ch++; System.out.println(ch); //prints :
Why did the ch++
make the program print a colon after the 9?
Answer
In ASCII character set :
comes after 9
, so when you increment you basically go to :
.