Exception in thread “main” java.lang.NumberFormatException: For input string: “S”

The letter S is not a number. Did you mean to write the number 5?

String s = "5";
System.out.println((char) Integer.parseInt(s));

Or did you mean to print the ASCII or Unicode value of the character S?

char s = 's';
System.out.println((int) s);

Leave a Comment