Operators in Java
Notes:
Operators in Java Programming Language :
Expression:
- is a valid combination of operators and operands, on evaluation it yields a result
Ex: 2 + 2, 10 – 2 etc.
Operator:
- is a symbol which performs an operation on the given operand(s)
Operand:
- is a value on which an operator performs an operation
Operators in any programming language are broadly categorized into
Unary Operators: accept only one operand.
Binary Operators: accept two operands.
Ternary Operators: accept three operands.
Types of Java Operators: LARA BICS
- Java provides rich set of operators to perform arithmetic, logical, comparison, etc.
L – Logical Operators : ( &&, || , ! )
A – Arithmetic Operators : ( +, -, *, /, % )
R – Relational Operators : ( <, >, <=, >=, ==, != )
A – Assignment Operators : ( = )
-- Short Hand Assignment: ( +=, -=, *=, /=, %=, &=, |=, ^=, <<= , >>=, >>>= )
B – Bitwise Operators : (&, |, ~, ^ )
-- Bitwise Shift: ( <<, >> , >>>)
I – Increment and Decrement Operators : (++ , --)
C – Conditional Operator : (?:)
S – Special Operators : ( instanceof, new, (type), etc. )