Difference between OR operator || and | in Java?
java
Solution
This is simple. http://www.roseindia.net/help/java/o/java-operator.shtml says:
OR operator is a kind of a conditional operators, which is represented by | symbol. It returns either true or false value based on the state of the variables i.e. the operations using conditional operators are performed between the two boolean expressions.
The OR operator (|) is similar to the Conditional-OR operator (||) and returns true, if one or another of its operand is true.
Note: In `||` operator if have more than one condition and if first condition `return true` then other conditions ignored but in `|` operator all condition examin.
There are more information on http://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html
Problem
Can any one explain the difference between and usage of OR operator ( `||` and `|` ) in java. thanks e.g: ``` if(a || b) { // Do something. } ``` and ``` if(a | b) { // Do something. } ```