Operators and Expressions

Operators in Java are used to perform operations on variables and values.

Types of Operators:

  • Arithmetic: +, -, *, /, %
  • Relational: ==, !=, >, <, >=, <=
  • Logical: && (AND), || (OR), ! (NOT)
  • Assignment: =, +=, -=, etc.

Example:

int a = 10;
int b = 5;
int sum = a + b; // 15
← PrevNext →