What is the output of: Int d= (8>0)?6:9; System.out.print(d);
Answers
Answered by
2
Output.
6
Explanation.
Correct code:
int d = (8 > 0) ? 6 : 9;
System.out.print(d);
Here, a variable named 'd' is declared which contains some value.
We have to find out the value of 'd' so that we can predict the output.
Now check - 8 > 0 is true.
So, the variable 'd' will be assigned with the value - 6.
The variable d is now printed on the screen.
So, output - 6.
Similar questions