This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes |  and  || operators 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 » Java » Beginning Java
Bookmark "|  and  || operators" Watch "|  and  || operators" New topic
Author

| and || operators

Angela Jessi
Ranch Hand

Joined: Nov 27, 2000
Posts: 428
I saw the post of Nancy about & and &&
It arise me one question
What is difference between | and | | operators
Thanks
Angela
Guy Reynolds
Ranch Hand

Joined: Oct 27, 2000
Posts: 61
Exactly the same as the difference between & and &&, | is the OR operator and | | is the short-circuit OR operator.
ie, instead of performing logical AND with booleans they perform logical OR with booleans. Also instead of performing bitwise AND with int types, | performs bitwise OR with int types.
[This message has been edited by Guy Reynolds (edited June 26, 2001).]
Angela Jessi
Ranch Hand

Joined: Nov 27, 2000
Posts: 428
Thanks
angela
Originally posted by Guy Reynolds:
Exactly the same as & and && except instead of performing logical AND with booleans they perform logical OR with booleans, also instead of performing bitwise AND with int types, | performs bitwise OR with int types.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: | and || operators
 
Similar Threads
logical operators for AND and OR
&& vs & , || vs |
Expression Evaluation with && and || operators
Jxam
short circuit logical operands