I have a capital letter defined in a variable string, and I want to output the next and previous letters in the alphabet. For example, if the variable was equal to \'C\'>
\'C\'>
One way:
String value = "C"; int charValue = value.charAt(0); String next = String.valueOf( (char) (charValue + 1)); System.out.println(next);