Char z = ‘a’; int var = (z = = ‘a’) ? ‘a’ : ‘a’;
system.out.println("var = " + var);
Answers
Answered by
2
Answer:
OUTPUT:
var = 97
Answered by
1
Question:-
Find the output of the following code.
Solution:-
Given code,
char z='a';
int var=(z=='a')?'a':'a';
System.out.println("var = "+var);
Here,
z=='a' is true.
So,
var='a'.
ASCII value of a is 97.
So,
var = 97
Output:-
var = 97.
Similar questions
Biology,
3 months ago
Hindi,
3 months ago
Accountancy,
3 months ago
Hindi,
7 months ago
Computer Science,
7 months ago
Math,
1 year ago
Psychology,
1 year ago
Computer Science,
1 year ago