CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
12
You visited us 12 times! Enjoying our articles? Unlock Full Access!
Question

The two operators && and | | are

A
Arithmetic operators
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
Equality operators
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
Logical operators
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
D
Relational operators
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is C Logical operators

The two operators && and | | are logical operators.

Logical operators are typically used with Boolean (logical) values. When they are, they return a Boolean value. However, the && and ||. operators actually return the value of one of the specified operands, so if these operators are used with non-Boolean values, they may return a non-Boolean value.

A logical operator in Java programming is an operator that returns a Boolean result that's based on the Boolean result of one or two other expressions.

Logical AND:- The ‘&&’ operator returns true when both the conditions in consideration are satisfied. Otherwise it returns false.

Example:- a && b returns true when both a and b are true (i.e. non-zero).

Logical OR:- The ‘||’ operator returns true when one (or both) of the conditions in consideration is satisfied. Otherwise it returns false.

Example:- a || b returns true if one of a or b is true (i.e. non-zero). Of course, it returns true when both a and b are true.


flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Logic Gates
PHYSICS
Watch in App
Join BYJU'S Learning Program
CrossIcon