What Are Different Types of Operators in Java

– Uniary ++, –, +, -, |, ~, ()

– Arithmetic *, /, %,+, –

-Shift <<, >>, >>>

– Comparison =, instanceof, = =,!=Bitwise &, ^, |Short Circuit &&, ||

Ternary ?:Assignment =

In Java, operators are special symbols or keywords that perform operations on operands. There are several types of operators in Java, broadly categorized as follows:

  1. Arithmetic Operators:
    • Addition: +
    • Subtraction: -
    • Multiplication: *
    • Division: /
    • Modulus: %
    • Increment: ++
    • Decrement: --
  2. Relational Operators:
    • Equal to: ==
    • Not equal to: !=
    • Greater than: >
    • Less than: <
    • Greater than or equal to: >=
    • Less than or equal to: <=
  3. Logical Operators:
    • Logical AND: &&
    • Logical OR: ||
    • Logical NOT: !
  4. Bitwise Operators:
    • Bitwise AND: &
    • Bitwise OR: |
    • Bitwise XOR: ^
    • Bitwise NOT: ~
    • Left shift: <<
    • Right shift: >>
    • Unsigned right shift: >>>
  5. Assignment Operators:
    • Assign: =
    • Add and assign: +=
    • Subtract and assign: -=
    • Multiply and assign: *=
    • Divide and assign: /=
    • Modulus and assign: %=
  6. Conditional (Ternary) Operator:
    • ? :
  7. Instanceof Operator:
    • instanceof
  8. Type Cast Operator:
    • (type) expression
  9. Miscellaneous Operators:
    • Conditional (Ternary) Operator: ? :
    • Member access operator (.)
    • Array index access operator ([])
    • Method call operator (())

Understanding and using these operators is fundamental to writing Java programs. Each operator serves a specific purpose and operates on one or more operands to produce a result.