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

Isaac mows his lawn every 8 days. Belinda mows her lawn every 10 days. On Monday, they both mowed their lawns. What is the least number of days that will pass b
what is science??????​
Which aspect of globalization have a positive or negative effect on your company?
a conclusion of the walking dance
Darnell’s car used 8 gallons of gasoline to travel 340 miles. After a mechanic worked on the car, it used 7 gallons of gasoline to travel 350 miles. If the pric
Why does Zarroff not hunt animals anymore? Explain fully​
Read the poem. Chores Spritz, clean, scrub. Wipe, swipe, rub Pane after pane. Windows are a waste! Unless… I share the clouds with a flock. A soaring clone
please open the lead of the water bottle into passive
Which personality trait best fits this description? A ella le gusta pintar y tocar los instrumentos musicales. A. artística B. simpática C. amable D.
how do you solve a volume of a cylinder in terms of pi?