Computer Science, asked by adityaagarwal1401, 6 months ago

2. What will be the result of the following program code? Explain
char x='A';
int m;
m=(x=='a')? 'a': 'A';
System.out.println("m="+m);​

Answers

Answered by ajb7899
0

Answer:

m = 65

The given statement is that of an conditional operator.

It will be checking whether the value of x is equal to 'a'or not.

Since the value of x = 'A' .Hence statement is wrong. therefore the second statement will be executed .

i. e. m = 'A'

but m is it int data type hence ASCII value of 'A' will be considered which is 65

Similar questions