Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / Knowledge base

Knowledge base

Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.

Entries: 5788

Java

Greater-than operator (>)

The > operator checks whether the left operand is strictly greater than the right and returns boolean. Equal values produce false. It operates on numeric values after numeric promotion; a comparison involving NaN always produces false.

Basic · Java SE 21; repository runtime, production runtime not attested
Java

Increment operator ++

The ++ operator adds 1 to a variable's value. Prefix ++count produces the new value, while postfix count++ produces the previous value; both store the result in the variable.

Basic · Java SE 21; repository runtime, production runtime not attested
Java

Inequality operator !=

The != operator returns boolean: it compares numeric or boolean values, while for references it tests object identity rather than contents.

Basic · Java SE 21; repository runtime, production runtime not attested
Java

instanceof — type patterns and flow scoping

The instanceof operator tests an object's compatibility with a type and returns boolean. A type pattern can also declare a variable available wherever the compiler can prove that matching succeeded. For null, the result is false.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

Lambda expression: ->

The -> symbol separates a lambda's parameters from its body. A lambda describes behavior for a functional interface; its body executes when the appropriate method is called, not when the lambda is assigned.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

Left-shift operator (<<)

The << operator shifts an integer's bits left, filling the right side with zeros. The promoted left operand determines the result width and how the shift distance is masked.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

Left-shift assignment operator (<<=)

The <<= operator shifts bits left and stores the result in the same variable. If the variable has a primitive type, the result is implicitly converted back to that type.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

Less-than-or-equal operator (<=)

The <= operator compares numeric values inclusively. It returns boolean; a comparison involving NaN returns false.

Basic · Java SE 21; repository runtime, production runtime not attested
Java

Less-than operator (<)

The < operator checks whether its left operand is strictly less than its right operand and returns boolean. Equal values produce false. Floating-point comparisons require care with NaN and signed zeros.

Basic · Java SE 21; repository runtime, production runtime not attested
Java

Logical AND operator &&

The && operator combines two conditions: the result is true only when both are true. When the left condition is false, the right condition is not evaluated.

Basic · Java SE 21; repository runtime, production runtime not attested
Java

Logical NOT operator !

The unary ! operator reverses a logical value: true becomes false, and false becomes true. It accepts boolean or Boolean and produces boolean. Applying it to a Boolean whose value is null throws NullPointerException.

Basic · Java SE 21; repository runtime, production runtime not attested
Java

Short-circuit logical OR operator (||)

The || operator combines conditions using logical OR. When the left operand is true, it skips the right operand; otherwise, it evaluates it.

Basic · Java SE 21; repository runtime, production runtime not attested
Java

Field access using the dot

The notation Type.FIELD / object.member distinguishes static field access through a type name from object field access. Field selection depends on the compile-time type, and instance field access requires a non-null reference.

Basic · Java SE 21; repository runtime, production runtime not attested
Java

Method reference (::)

The :: syntax adapts an existing method, constructor, or array creation operation to a functional interface. It does not invoke the referenced operation immediately; the target type determines compatible parameters and the result.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

Multiplication operator (*)

The * operator computes the product of two numeric values. Operand types determine the result type; integer overflow does not throw an exception.

Basic · Java SE 21; repository runtime, production runtime not attested
Java

Multiplication assignment operator (*=)

The *= operator multiplies a variable's existing value by the right operand and stores the result back, converting it to the variable's type.

Basic · Java SE 21; repository runtime, production runtime not attested
Java

Remainder operator (%)

The % operator computes the remainder of integer or floating-point division. Its result is not necessarily nonnegative.

Basic · Java SE 21; repository runtime, production runtime not attested
Java

Remainder assignment operator %=

The %= operator calculates a remainder and stores it in the left operand, implicitly converting the result.

Basic · Java SE 21; repository runtime, production runtime not attested
Java

Signed right-shift operator (>>)

The >> operator shifts bits right while replicating the sign bit. Learn operand promotion, distance masking, and how it differs from >>> and division.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

Right-shift assignment >>=

The >>= operator shifts bits right with sign extension and stores the result back in the same variable.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

Subtraction operator (-)

The binary - operator subtracts its right operand from its left operand. Learn numeric promotion, grouping, and integer overflow when subtracting values in Java SE 21.

Basic · Java SE 21; repository runtime, production runtime not attested
Java

Subtraction assignment operator (-=)

The -= operator subtracts the right operand from a variable's value and stores the result in that same variable.

Basic · Java SE 21; repository runtime, production runtime not attested
Java

Unary minus

The `-x` operator computes arithmetic negation after numeric promotion. It does not change `x`. At the minimum `int` or `long` value, overflow leaves the value unchanged.

Basic · Java SE 21; repository runtime, production runtime not attested
Java

Unary plus operator

The expression +x returns the value of x after unary numeric promotion. It neither changes the sign nor increments x, but it can change the result type: byte, short, and char are promoted to int.

Basic · Java SE 21; repository runtime, production runtime not attested