Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / Java

Knowledge base — Java

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

Entries: 813

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
Java

Unsigned right shift operator (>>>)

The >>> operator shifts bits right and fills vacated positions on the left with zeros. Learn how it differs from >>, how operands are promoted, and how shift distances are masked.

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

Unsigned right shift assignment (>>>=)

The >>>= operator shifts bits right, fills vacated positions with zeros, and stores the result in the same variable. Unlike >>=, it does not sign-extend; promotion and conversion back matter for narrow types.

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

System.out.println: practical reference

System.out.println: practical reference: PrintStream.println writes the selected value using the matching overload, then writes the platform line separator; Object values are converted through String.valueOf.

Intermediate · Java SE 21 (JLS and Java SE API); examples verified on the repository Java runtime
Java

Java annotations: targets, retention, repetition, and reflection

In Java SE 21, an annotation declaration defines its data, where it may appear, and whether it is visible at run time. Learn how reflection reads that metadata, how repeated annotations are inherited, and how to scope unchecked-warning suppression.

Advanced · Java SE 21
Java

Annotation types — @interface

An @interface declaration defines an annotation type: metadata attached to code. Elements describe the annotation's data, while meta-annotations control allowed locations, retention, repeatability, and inheritance.

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