File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Confusion with expression... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Confusion with expression..." Watch "Confusion with expression..." New topic

Confusion with expression...

ishmayel vemuru
Ranch Hand

Joined: Jun 13, 2007
Posts: 45

boolean b1 = true;
boolean b2 = false;
System.out.println(" " + (b2 ^ b1));
Can any one explai pleas.....
I think the table like this....
|b1 | b2 | ^ result |
| false | false | false |
| false | true | true |
| true | false | true |
| true | true | false |

is it Corect..?
thanks in advance..
Dan Meyer

Joined: Nov 08, 2007
Posts: 2
Correct: ^ is eXclusive OR (aka xor and never short circuts) takes two booleans and true when one and only one of the booleans are true.
I agree. Here's the link:
subject: Confusion with expression...
Similar Threads
Confusing TRUE and FALSE
Something about auto-boxing/unboxing in SE5
Wrappers question
Boolean operators
Short-Circuit Operators.....