liyaahbear2068 liyaahbear2068
  • 02-09-2019
  • Computers and Technology
contestada

What is the result of expression 15 > 10 > 5 in C? What is the result of the same expression in Java?

Respuesta :

oscarporras02
oscarporras02 oscarporras02
  • 07-09-2019

Answer:

java: error

C: false

Explanation:

In Java the compiler understand that you are trying to compare an integer (15) with a boolean (10 > 5) this generate the next error:

error: bad operand types for binary operator  

In C the compiler convert (15 > 10 > 5) in (15>10) > (10>5) which is equal to TRUE > TRUE, the compiler can also read it as 1 > 1 (since 1 is TRUE and 0 is FALSE).  like 1>1 is false then C program return false.

Answer Link

Otras preguntas

why do sedimentary rocks generally form underwater
Convert 500 cm to meters
Many companies are allowing employees to set their own work hours. For example, a company may require its employees to work 8 hours a day, but the employees dec
The image above shows a(n) blank a narrow body of water that connects two larger bodies water
In to kill a mockingbird what was the klu klux klan? what do you think of atticus's comment about it
After an explosive volcanic eruption on an island, the surrounding sea is full of light-gray floating rock. what must it be?
I need the answers and the work
what is the ratio of third-order consumers to producers?
Hi I don't know how to do this please can u help me???
Graph x^3-x^2-2x=0 what are the solutions of the equation