Java char type increment operator

Question

What is the output of the following code?

public class Main {
  public static void main(String[] args) {
    char ch = 'a';
    System.out.println(++ch);

    System.out.println(ch);
  }
}


b
b

Note

The increment and decrement operators can also be used on char variables to get the next or preceding Unicode character.




PreviousNext

Related