Thursday, 5 September 2013

Why doesn't a character increment in System.out.println()?

Why doesn't a character increment in System.out.println()?

char1 = a;
System.out.println(char1);
system.out.println(char1+1);
char1 += 1;
System.out.println(char1);
In the above, why doesn't line 3 print 'b", but when I do the increment
outside of the function call, line 5 prints 'b' as I'd expect?

No comments:

Post a Comment