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

how can bureaucratic personality be dangerous
Perimeter of a square with an area of 81cm2
Please answer:If a stadium holds 60000 people.1. If the stadium is 2/3 full, how many people are there?2. If the stadium is 3/4 full, how many people are there?
David helped his father stock the pond with baby catfish and blue gill. They put in a total of 75 fish. If the number of blue gill was doubled and the number of
How is 3x-y=8 and x+2y=5 solved by combination (addition)?????
Hello, I need help please for mission 3 thank you very much.
how can bureaucratic personality be dangerous
State whether the following statements are true or false. Justify.(i) For an arbitrary binary operation * on a set N,  a * a = a ,  for all a * N.(ii) If * is a
What were the reasons for the failure of the League Nations?
The statement, "right angles measure 90 degrees," is an example of: A postulate A definition A theorem A conjecture