What will be the output of the following code snippet? char ch='A'; int n=(ch=='a')?'A':'a'; System.out.println("n:"+n);
Answers
Answered by
3
Answer:
Please mark as brainliest answer
Attachments:

Answered by
2
Answer:
This question will give you a run time error
Explanation:
As all three variables are taken in different data types so typecasting needs to be done.
The correct code will be:
char c='A';
int m=26;
ch=(int)c;
n=ch+m;
Here, I have converted the value of 'A' to ASCII value and now ur addition will be done.The answer will be 65+26=91
Similar questions