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
  • 20,752
  • 7
  • 62
  • 64

0 Answers0