+ 2

What this a || b is used for???

i aM sOo confused to know about this!!

28th Jan 2017, 1:47 PM
INAM UR RAHMAN
INAM UR RAHMAN - avatar
13 Answers
+ 4
It means a or b, "||" is the operator
28th Jan 2017, 1:53 PM
Jieun Park
Jieun Park - avatar
+ 3
It is one of the logical operator whose two operands should be expressions. If any one of the two operand's expression is true, the output will be true. Example: int a=0, b=5; boolean result = (a>2) || (b==5) then result will be true. The same is applicable for more than two operands also
14th Feb 2017, 11:01 AM
Kommoju Sunil Kumar
Kommoju Sunil Kumar - avatar
+ 2
it is or operator used for comparision
3rd Feb 2017, 5:43 PM
Ankit thakur
Ankit thakur - avatar
+ 1
it is an operator "||". it is short form of or.
28th Jan 2017, 2:42 PM
Monika Bhatia
Monika Bhatia - avatar
+ 1
If you are comparing values with each other your answer will be true or false. If you have an boolean value (0=false / 1=true) and compare it to another, you will receive an answer depending on your comparison. Example: boolean a = true, b = true, c = false; boolean d; d = a&&b; // True d = a&&c; // False d = a || c; // True On an AND compare you need both input values true. But on an OR compare you need just one of them. You can go on and compare even bytes with each other. Example: Byte a = 23; // 0001 0111 Byte b = 44; // 0010 1010 Byte c = a && b // 0000 0010 = 2 Byte d = a || b // 0011 1111 = 63 But be careful. The MSB (most-significant-bit) is the sign. 0111 1111 = 127 1000 0000 = -128 1000 0001 = -127 ... 1111 1111 = -1 In this case we are talking about an overflow.
15th Feb 2017, 7:47 PM
Philipp Brandin
Philipp Brandin - avatar
+ 1
'||' is the logical 'OR' operator. For example 'a||b' means 'whether a OR b' . ie., either a or b are true.
18th Feb 2017, 12:48 PM
Noulmon K C
Noulmon K C - avatar
0
thnkio
28th Jan 2017, 2:01 PM
INAM UR RAHMAN
INAM UR RAHMAN - avatar
0
|| is OR operator If any of the condition is True the expression will be true.
28th Jan 2017, 2:17 PM
Arpan Lunawat
Arpan Lunawat - avatar
0
It's logical operator. if one of them condition is true it will execute. if both condition true it will execute also. if both are not true then it will go to next statement/condition.
29th Jan 2017, 10:42 AM
Nazeer Ahmed
Nazeer Ahmed - avatar
0
This mean A or B, and if you want to have A and B you can use && . Have a good day
1st Feb 2017, 7:55 PM
Nizar Al Danaf
Nizar Al Danaf - avatar
0
|| is or && is and
6th Feb 2017, 9:09 PM
James W Swift
James W Swift - avatar
0
|| is OR operator and there is also | operator
14th Feb 2017, 12:53 AM
Easy Earn (Easy Earn)
Easy Earn (Easy Earn) - avatar
- 1
it means a or b
19th Feb 2017, 6:52 PM
Hayat GĂŒnce Gemalmaz