Incrementing and decrementing a char variable

Report a typo

Suppose we have a char type variable 'a' initialized to 'A' in Java. You need to write a program to increment the 'a' value by one, print it out, then immediately decrement it by one and also print this one. Please ensure that all operations happen within the main method and remember to convert the char values to String when printing. Reorder the lines of code to create an output that follows the specified rules.

Reorder lines using drag or arrows. Adjust indentation with left buttons
                char a = 'A';
              
                a--;
              
                public class Main {
              
                a++;
              
                }
              
                System.out.println(String.valueOf(a));
              
                System.out.println(String.valueOf(a));
              
                }
              
                public static void main(String[] args) {
              

Create a free account to access the full topic