Java Operators & Expressions

0.0(0)
studied byStudied by 0 people
full-widthCall with Kai
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/18

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

19 Terms

1
New cards

Operator

A symbol that performs an action on values (operands) and produces a result.

2
New cards

Arithmetic Operators

Used for basic math operations:

  • + (add), - (subtract), * (multiply), / (divide), % (modulus = remainder).

3
New cards

Assignment Operators

Assign values to variables. Examples:

  • = (basic assignment)

  • +=, -=, *=, /=, %= (combine operation + assignment).

4
New cards

Unary Operators

Work on a single operand. Examples:

  • + (positive), - (negative)

  • ++ (increment), -- (decrement)

  • ! (logical NOT)

5
New cards

Pre-Increment / Pre-Decrement

Changes the value before it’s used in an expression.

6
New cards

Post-Increment / Post-Decrement

Changes the value after it’s used in an expression.

7
New cards

Comparison / Relational Operators

Compare two values and return true/false:

  • ==, !=, >, <, >=, <=.

8
New cards

Shift Operators

Move bits left or right in binary form:

  • << (left shift), >> (right shift), >>> (unsigned right shift).

9
New cards

Bitwise Operators

Operate on individual bits:

  • & (AND), | (OR), ^ (XOR), ~ (NOT).

10
New cards

Logical Operators

Combine boolean expressions:

  • && (AND, short-circuit), || (OR, short-circuit).

11
New cards

Short-Circuit Evaluation

When using && or ||, Java may skip the second condition if the first one already decides the result.

12
New cards

Conditional (Ternary) Operator

Shorthand for if-else: (condition) ? valueIfTrue : valueIfFalse.

13
New cards

Order of Precedence

Rules that decide which operator runs first. Higher precedence executes earlier (e.g., * before +). Parentheses () can override.

14
New cards

Expression

A combination of variables, constants, and operators that evaluates to a single value.

15
New cards

Arithmetic Expression

An expression that uses arithmetic operators (e.g., x + y).

16
New cards

Assignment Expression

An expression that assigns a value (e.g., a = b + 4).

17
New cards

Relational Expression

An expression that compares values and returns true/false (e.g., x < y).

18
New cards

Logical Expression

An expression that combines conditions with logical operators (e.g., (a > b) && (b < 10)).

19
New cards

Conditional Expression

An expression using the ternary operator to choose a value (e.g., (x > y) ? x : y).