- 2
What is this mean in java:
1_a%b 2_a||b 3_true||false
2 Answers
+ 3
a % b - gives the remainder of the division. '%' is called a modulo operator
int a = 11;
int b = 5;
System.out.println(11 % 5); // returns the remainder (1)
a || b - returns boolean value of true, if one or both are true. It returns false only, if both are false.
OR:
0 || 0 -> false
0 || 1 -> true
1 || 0 -> true
1 || 1 -> true
boolean a = 5 == 5; // true
boolean b = 5 > 5; // false
System.out.println(a || b); // returns true, got it?
So:
true || false = ?
For more: search in Google about the
boolean and bitwise operators and logic.
0
https://www.sololearn.com/discuss/760413/?ref=app
in addition to above answers || provides more info