1/18
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Operator
A symbol that performs an action on values (operands) and produces a result.
Arithmetic Operators
Used for basic math operations:
+
(add), -
(subtract), *
(multiply), /
(divide), %
(modulus = remainder).
Assignment Operators
Assign values to variables. Examples:
=
(basic assignment)
+=
, -=
, *=
, /=
, %=
(combine operation + assignment).
Unary Operators
Work on a single operand. Examples:
+
(positive), -
(negative)
++
(increment), --
(decrement)
!
(logical NOT)
Pre-Increment / Pre-Decrement
Changes the value before it’s used in an expression.
Post-Increment / Post-Decrement
Changes the value after it’s used in an expression.
Comparison / Relational Operators
Compare two values and return true/false:
==
, !=
, >
, <
, >=
, <=
.
Shift Operators
Move bits left or right in binary form:
<<
(left shift), >>
(right shift), >>>
(unsigned right shift).
Bitwise Operators
Operate on individual bits:
&
(AND), |
(OR), ^
(XOR), ~
(NOT).
Logical Operators
Combine boolean expressions:
&&
(AND, short-circuit), ||
(OR, short-circuit).
Short-Circuit Evaluation
When using &&
or ||
, Java may skip the second condition if the first one already decides the result.
Conditional (Ternary) Operator
Shorthand for if-else: (condition) ? valueIfTrue : valueIfFalse
.
Order of Precedence
Rules that decide which operator runs first. Higher precedence executes earlier (e.g., *
before +
). Parentheses ()
can override.
Expression
A combination of variables, constants, and operators that evaluates to a single value.
Arithmetic Expression
An expression that uses arithmetic operators (e.g., x + y
).
Assignment Expression
An expression that assigns a value (e.g., a = b + 4
).
Relational Expression
An expression that compares values and returns true/false (e.g., x < y
).
Logical Expression
An expression that combines conditions with logical operators (e.g., (a > b) && (b < 10)
).
Conditional Expression
An expression using the ternary operator to choose a value (e.g., (x > y) ? x : y
).