Ask your own question, for FREE!
Computer Science 21 Online
OpenStudy (tonythegoat):

Help with Java Programming? Consider the following declrations. int y = 5; int z = 10; Which of the following expressions evaluates to true? A. y > 5 && z >= 10 B. z / y >= 2 && y * 2 > z C. y - z > 0 || y * 4 == z * 2 D. y + z == z + y && z - y == y - z

OpenStudy (rsmith6559):

The or statement.

OpenStudy (saov):

You must consider this rules: For OR ( In java is || ): (true condition) or (false condition) = true declaration , in java (or) is equals to || (false condition) or (true condition) = true declaration (false condition) or (false condition) = false declaration (In OR, It Just needs one true condition for the declaration has be true) For AND (In java is && ): (true condition ) AND (false condition) = false declaration (true condition) AND (false condition) = false declaration (false condition) AND (false condition) = false declaration (true conditoin) AND (true condition) = true declaration (In AND, It needs both true conditions for the declaration has be true) ATT: the sol. is C.

OpenStudy (saov):

In C, the second condition : y * 4 == z * 2 is true , therefore, the declaration is true. (Remember the OR rules).

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!