File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Confusion with expression...

 
ishmayel vemuru
Ranch Hand
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic