Value Following Java Expression Given Int 3 B 5 C 4 D 6 B C D Q37116147

What is the value of the following Java expression, given:

int a = 3, b = 5, c = 4, d = 6;

        !(a < b) || c >d


Solution


int a = 3, b = 5, c = 4, d = 6;

        !(a < b) || c >d

First (a<b) and (c>d) are calculated:

==> !( 3 < 5) || (4 > 6)

==> !(true) || false

Now !(true) will be evaluated

==> false || false

Now || operator will be evaluated.

==> false.

So the final output will be false.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.