BCA / B.Tech 8 min read

Operators in Java

Operators in Java:

Operators in Java are special symbols that perform specific operations on one, two, or three operands, and then return a result.

Types of Operators:
  • Arithmetic Operators: Used for mathematical calculations. (`+`, `-`, `*`, `/`, `%`)
  • Relational Operators: Used to compare two values. (`==`, `!=`, `>`, `<`, `>=`, `<=`)
  • Logical Operators: Used to perform logical operations on boolean values. (`&&`, `||`, `!`)
  • Assignment Operators: Used to assign values to variables. (`=`, `+=`, `-=`, `*=`, `/=`)
  • Increment and Decrement Operators: Used to increment or decrement a value by one. (`++`, `--`)
  • Bitwise Operators: Used to perform bit-level operations on integer values. (`&`, `|`, `^`, `~`)
  • Ternary Operator: A shorthand for an if-else statement. (`? :`)