Tsallaka zuwa abun ciki
Justice Tech School

Operators

Arithmetic: + - * / %. Increment ++ and decrement --. Comparison: == != < > <= >=. Logical: && || !. Use += style shortcuts to update a variable. The ternary operator condition ? a : b is a short if/else.

Example
int x = 10;
x += 5;
x++;
System.out.println(x);
System.out.println(17 % 5);
System.out.println(x > 10 && x < 20);
String size = x > 15 ? "big" : "small";
System.out.println(size);

Result

16
2
true
big

Exercise

Which operator gives the remainder?

int r = 17  5;

Quiz Test

What does && mean?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.