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.
Characters
Incrementing and decrementing a char variable
Report a typo
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
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.