Computer Science, asked by uniqueperson, 1 year ago

plz explain this java snippet how the answer97 came ?

Attachments:

Answers

Answered by harmankaur04
2
See.. the value stored in x= 'A'
which when checked in the ternary gives u the ASCII of it I. e. 65
now in m, it states whether 'A'(the value stored in x) is equal to 'a'... For the condition being false the command will go the second one which is a.
(If the condition is true the first expression is executed otgerwise the second one)
As m is int type.. the ASCII of 'a'will be stored which is 97.
So m now has 97 stored in it.. and as the next statement says to print m.. so 97 has been printed.


hope it helps you.. let me know if u have any problem in understanding it
Similar questions