0

This code is working-

public class charTest {


    public static void main(String[] args) {
        char ch1= 'Y';

        System.out.println(ch1);
        ch1++;
        System.out.println(ch1);
    }
}

But why the below code is not working?

public class charTest {
    public static void main(String[] args) {

    char ch1= 'Y';

        System.out.println(ch1);

        ch1=ch1+1;
        System.out.println(ch1);
    }
}

Isn't ch1++ and ch1+1 supposed to be the same thing?

Minhas Kamal
  • 17,370
  • 5
  • 57
  • 58

0 Answers0