Home › coding › java › java operators

Java Operators — Free Java Tutorial

Learn Java Operators in Java with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.

✓ 100% Free ✓ No Login Needed ✓ NCERT / CBSE Aligned ✓ Download as PDF

TL;DR: Learn Java Operators in Java with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.

Written & reviewed by the Syllab.in Academic Team (CBSE/NCERT subject experts) · Updated Jul 14, 2026

🤖 Stuck on any question? Ask Syllab's free AI Tutor for a step-by-step explanation — instant, unlimited, no login.

Java Operators in Java

Java provides several categories of operators: arithmetic (+, -, *, /, %), relational (==, !=, <, >, <=, >=), logical (&&, ||, !), assignment (=, +=, -=, *=, /=), and bitwise (&, |, ^, ~, <<, >>).

The modulo operator % returns the remainder of division: 10 % 3 = 1. It is extremely useful for checking even/odd, cycling through values, and many algorithms.

Java evaluates expressions following operator precedence (BODMAS equivalent). Use parentheses to make precedence explicit and avoid bugs.

The ternary operator is a compact if/else: condition ? valueIfTrue : valueIfFalse. It is an expression (returns a value), not a statement.

Integer division truncates the decimal: 7/2 = 3, not 3.5. Cast at least one operand to double for decimal results: (double)7/2 = 3.5.

Java Operators — Syntax

// Arithmetic
int a = 10, b = 3;
int sum  = a + b;   // 13
int diff = a - b;   // 7
int prod = a * b;   // 30
int quot = a / b;   // 3  (integer division)
int rem  = a % b;   // 1

// Compound assignment
a += 5;  // a = a + 5
a++;     // a = a + 1

// Ternary
String result = (a > b) ? "a is bigger" 

Learn Java Operators step by step with Syllab's free interactive Java tutorial — runnable code examples, practice exercises and instant AI feedback, all free with no signup. Explore the full Java course →

Explore:

  • Syllabus
  • Practice
  • Mock Tests
  • NCERT Solutions
  • Coding
  • GK Quiz
  • Career Predictor
  • AI Tutor
  • Live Quiz
  • Doubt Solver
  • Microlearning
  • Free Alternatives
  • Kids Zone
  • Study Room
  • Calculators
  • Worksheets

Syllab.in — Free learning for Indian students, Class 1–12