Operators in Java

From the Java cheat sheet · Operators · verified Jul 2026

Operators

Everyday operators plus the ternary and instanceof pattern.

java
// Quick Reference
+  -  *  /  %          // arithmetic
== != <  >  <= >=      // comparison
&& ||  !               // logical
condition ? a : b      // ternary
💡 Integer division drops the remainder; make one operand a double for real division.
⚡ && and || short-circuit - the right side is skipped when the result is known.
📌 instanceof pattern binds a typed variable, removing the manual cast.
🟢 Use == for primitives, but .equals() to compare object contents like Strings.
operatorsinstanceof

Continue with Java

Save the full cheat sheet or work through every related task.

Back to the full Java cheat sheet