0
votes

Consider the below code snippet using ternary operator in print statement

public static void main(){
    char a='A';
    int i=0;
    System.out.println(true?a:0);
    System.out.println(false?i:a);
}

The output of the above snipped is:

A 
65

Why is the output not as below:

A
A