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

What is the product of 709 and 68?
PLEASE FAST!!!! WILL GIVE BRAINLIEST!!!
Name the types of migration and give an example of each
Normal Distribution- Empirical Rule - please help
need help please, I dont exactly get how to do this. Thank you!
1, 8, 5, 4, 1, 8, 5, 4 mean media mode
Which two numbers have a 3 that is 10 times the value of the 3 in 1,249.35?
carrie is building a wooden birdhouse for her mom. She finds a plank in the garage to use for the base. When she realizes its too long, Carrie cuts 3 inches off
Which option distinguishes what most likely sickened Shailee in the following scenario? Shailee bought ground beef, pasta, and tomato sauce, and made spaghetti
A. 225 B. 25 C. 150 D. 50