Understanding Operators in Java
Well, operators are some symbols that are used to perform some operations, like we use + for addition when we use it with numbers, = to assign value to some variable, and a lot more operators are there. We have been knowingly or unknowingly making use of some operators inside our program. Now we are going to explore some more operators in greater detail.
Understanding Operators
So, here are some types of operators in Java →
What are operators in Java
- Arithmetic Operators → These are some symbols used to perform arithmetic operations on values(numbers). Here are the arithmetic operators → (+,-,*,/, %, ++, –)
- Assignment Operators → These are some symbols used for assignment purposes(not our college assignment or school assignment, but in assigning values to variables). Here are some assignment operators → (=,+=,-=, *=, /=, %=)
- Comparison Operators (Relational Operators) → These are some symbols used to perform comparisons between values, like are the two values equal or is some value greater than the other one or something like that. Here are some comparison operators → (==, !=, >,<, >= ,<=)
- Logical Operators → These are some symbols used to perform logical operations. We will understand these operators later since it requires a little more explanation. Here are some logical operators → (&&, ||, !)
- Bitwise operators → These are the symbols used for performing bitwise operations, i.e operations on bits. We are going to see this too later since it requires some explanation.
Now, since we have listed some of the operators above in brief, it’s time to dive into details about each type of operator. Let’s discuss these operators one by one now.