Incrementing and decrementing a character

Report a typo

Given the lines of a Java program that performs increment and decrement operations on a character, your task is to reorder these lines correctly. The intended program should first initialize a character 'A', increment its Unicode value to get the next letter in the alphabet, and then print the result. After that, the program should decrement the Unicode value to get back to the initial character and print that out.

Reorder lines using drag or arrows. Adjust indentation with left buttons
                }
              
                public class Main {
              
                char letter = 'A';
              
                letter--;
              
                public static void main(String[] args) {
              
                System.out.println("We are back at: " + letter);
              
                System.out.println("Next letter after A is: " + letter);
              
                letter++;
              
                }
              
___

Create a free account to access the full topic