An operator is a character that represents an action.
Operator in Java is a symbol which is used to perform operations.
Java provides many types of operators which can be used according to the need. They are classified based on the functionality they provide.
Watch full video for Data Types in Java - • Data Types in Java || Primitive Data Types...
0:00 - Introduction
00:58- Types of Operators
03:00 - Arithmetic operators
04:42 - Comparison (Relational) operators
06:51 - Logical operators
08:54 - Assignment operators
11:03 - Increment and Decrement operators
13:22 - Conditional (Ternary) operators
14:40 - Bitwise operators
22:26 - Shift operators
23:58 - Left shift operator
26:06 - Right shift operator
26:45 - Signed Right shift operator
29:45 - Unsigned Right shift operator
=== Types of Operator in Java ===
1) Basic Arithmetic Operators
2) Assignment Operators
3) Auto-increment and Auto-decrement Operators
4) Logical Operators
5) Comparison (relational) operators
6) Bitwise Operators
7) Ternary Operator
8) Shift Operator
9) instance of operator
[1] Arithmetic Operators: They are used to perform simple arithmetic operations on primitive data types.
Basic arithmetic operators are: +, -, *, /, %.
[2] Assignments operators: It is used to assign the value on its right to the operand on its left.
Assignments operators are: =, +=, -=, *=, /=, %=
There are three types of Assignments :
I. Simple Statement
II. Compound Statement
III. Assignment as a Expression
[3] Auto-increment and Auto-decrement Operators are : ++ and —
[4] Logical Operators are used with binary variables. They are mainly used in conditional statements and loops for evaluating a condition.
Logical operators in java are: &&, ||, !
[5] Comparison(Relational) operators: These operators are used to check for relations like equality, greater than, less than.
They return boolean result after the comparison and are extensively used in looping statements as well as conditional if else statements.
[6] Bitwise Operators : These operators are used to perform manipulation of individual bits of a number.
They can be used with any of the integer types.
-They are used when performing update and query operations of Binary indexed tree.
[7] Ternary Operator : Ternary operator is a shorthand version of if-else statement. It has three operands and hence the name ternary.
[8] Shift Operators :These operators are used to shift the bits of a number left or right thereby multiplying or dividing the number by two respectively. - - They can be used when we have to multiply or divide a number by two.
[9] instance of operator : Instance of operator is used for type checking. It can be used to test if an object is an instance of a class, a subclass or an interface.
#LearningandTeachingCoding