bomba923
- 759
- 0


*for example (I'll add 8 to a certain digit in an integer),
String nmbr; //where I enter a number
int pst; //an integer representing the position of that digit in the number
System.out.println( nmbr.charAt(pst) + 8 );
---------
Obviously, I cannot add a character and an integer. Thus, I change to:
---------
System.out.println( Integer.parseInt(String.valueOf(nmbr.charAt(pst))) + 8 );
-----------------------
and it works, no compiling errors.
*However, is there a shorter way of converting a character representation of an integer to...well, an integer?

" Integer.parseInt(String.valueOf(nmbr.charAt(pst))) " ?