|1||Boolean Logical Operators Output|
|2||Simple if example output|
|3||If else condition output|
|4||If else condition with multiple statements|
|5||Multiple if else conditions output|
|6||Compare FindWinner1 and FindWinner2 programs|
|7||Relation Operators Output|
|8||Operators program output|
|9||Calculate the volume at a given pressure|
|10||Rabbit Donkey Leporidae|
|11||Floating point data types|
|13||Arithmetic operators and Basic Arithmetic operators|
What will be the output of the following program?
Correct Answer : A
In both the programs, two integer variables namely
pakistan_score are declared and initialized to
290 respectively. The
if condition is checked i.e.,
india_score > pakistan_score which returns
true, thus India Wins is printed.
In second program, the display statement has a ternary operator with condition
india_score > pakistan_score, as this is also
true, India Wins is printed.
Thus both the programs generate same output.
Topic: if Condition In Java