[Solved] How to increment the string value? [duplicate]


Integer.parseInt(a+1); parses the String that results from concatenating the value of the String a (“1”) to the int literal 1, which is “11”.

Change it to

int inc = Integer.parseInt(a) + 1;

This way “a” would be parsed to the integer 1 and then 1 would be added to it to give you the value 2.

1

solved How to increment the string value? [duplicate]