User Tag List

1. Hello.

Could anyone explain me the result of this:

Show the result of the following Boolean expressions if the result can be determined.

(true) && (3 > 4)
!(x > 0) && (x > 0)
(x > 0) || (x < 0)
(x != 0) || (x == 0)
(x >= 0)||(x < 0)
(x != 1) ==!(x = 1)

Thank you.

2. What is x? That can make a difference for the results. Let's assume x is 1. Why not have JavaScript do the work for you...

<script language="JavaScript">
<!--
var x = 1
document.write ("x = " + x + "<br>");
document.write ("(true) && (3 > 4) " + ((true) && (3 > 4)) + "<br>" );
document.write ("!(x > 0) && (x > 0) " + (!(x > 0) && (x > 0)) + "<br>" );
document.write ("(x > 0) || (x < 0) " + ((x > 0) || (x < 0)) + "<br>" );
document.write ("(x != 0) || (x == 0) " + ((x != 0) || (x == 0)) + "<br>" );
document.write ("(x >= 0)||(x < 0) " + ((x >= 0) || (x < 0)) + "<br>" ) ;
document.write ("(x != 1) ==!(x = 1) " + ((x != 1) ==!(x = 1)) + "<br>" );
// -->
</script>

If you don't understand what all of the symbols are ( ||, &&, ==), they're comparison operators.

!= Test for inequality
== Test for equality
&& Logical AND
|| Logical OR

3. So with x being 1, the following results are shown...

(true) && (3 > 4) false
!(x > 0) && (x > 0) false
(x > 0) || (x < 0) true
(x != 0) || (x == 0) true
(x >= 0)||(x < 0) true
(x != 1) ==!(x = 1) true

4. Hello.

I've to say that this is for my sister. She is learning Java on University.

The teacher give her this exercise. She asks me but me and Java, unhappyly, we have (until now) a distant relationship.

magi::::::::::::::

5. And just for the record, remember that Java and JavaScript are not the same thing. The example I have above uses JavaScript. You can do the comparisons in Java too, but the syntax is different.

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•