0

Can we increment or decrement the characters in java?

How they are incrementing ? what if we increment 'z'?

19th Aug 2018, 8:31 AM
Indu Devarashetty
Indu Devarashetty - avatar
7 Antworten
+ 2
Each character is stored as a number. a-z are next to each other, so incrementing a gives b etc. z has value 122 in ASCII, incrementing should yield { with value 123 https://code.sololearn.com/cJgy1JYCfgv8/?ref=app
19th Aug 2018, 8:54 AM
michal
+ 1
Why do not you just try?)
19th Aug 2018, 8:34 AM
Roman Khristoforov
Roman Khristoforov - avatar
+ 1
thank you very much . It is very helpful
19th Aug 2018, 8:59 AM
Indu Devarashetty
Indu Devarashetty - avatar
19th Aug 2018, 9:10 AM
michal
0
I have tried , characters were incremented .But when we increment 'z' , output is empty.Why so?
19th Aug 2018, 8:47 AM
Indu Devarashetty
Indu Devarashetty - avatar
0
how do you print? it would be desirable to see the code. Example: public class Program { public static void main(String[] args) { char c = 'z'; c++; System.out.println(c); } }
19th Aug 2018, 8:52 AM
Roman Khristoforov
Roman Khristoforov - avatar
0
if we increment this '{' then what the output mean?
19th Aug 2018, 9:04 AM
Indu Devarashetty
Indu Devarashetty - avatar