Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes Operator Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Operator Question" Watch "Operator Question" New topic
Author

Operator Question

Ali Khan
Greenhorn

Joined: Sep 27, 2005
Posts: 18
HI,
I was wondering what the OR operation is in Java. I know that the AND operation is && and just need to know the Or. I used to know it from c++ but have forgotten =(
Mark Van Tuyl
Ranch Hand

Joined: Mar 22, 2002
Posts: 60
The OR operator is ||


<a href="http://www.catb.org/~esr/faqs/smart-questions.html" target="_blank" rel="nofollow">How To Ask Smart Questions</a>
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
Both Java and C++ have two AND operators and two OR operators. && and || are the most commonly used because they typically appear in boolean expressions. & and | are usually used for bitwise manipulation, but can be used in boolean expressions as well. However, the behavior is slightly different because && and || "shortcut" the evaluation of the right operand depending on the value of the left one. You can search these forums or google for "shortcut operators" to find out more about this.

Layne


Java API Documentation
The Java Tutorial
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Operator Question
 
Similar Threads
Design pattern for handling multiple String inputs
jasperreport ireport textfield expression
SOAP
operator precedence
how to edit the users/entries in LDAP