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.
CKTIS / Knowledge base
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
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.
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.
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.
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.
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.
An anonymous class lets you define an interface implementation or a subclass and create an instance of it in the same expression.
An array initializer creates an array from values enclosed in braces. The number of entries determines its length.
Declare and create arrays, read and replace elements by index, and distinguish array length from list size. See what `new List[2]` creates and how to avoid raw `List` in new code.
A `.class` literal gives you the object that represents a named type. Use it to filter values, specify an `EnumMap` key type, select a monitor, or configure a field updater.
A lambda can capture a local variable without the `final` modifier if it is effectively final. A fixed reference does not make the object it points to immutable.
In Java SE 21, an `enum` constant can pass arguments to the enum constructor and have its own class body to define its behavior.
Bounds restrict which types can be used as generic arguments. Learn how to preserve a builder’s concrete type, compare values through a supertype, and require several bounds at once.
Learn why `Spliterator<String>.tryAdvance` can take a consumer of `String` or a consumer of a supertype such as `CharSequence`.
A hexadecimal integer literal expresses a value in base 16 using the prefix 0x or 0X. The suffix L selects long; without a suffix, the literal has type int.
An inner member class is tied to a specific instance of its enclosing class and can read that object's private fields.
Write `10000000001L` to make a `long` literal. Without the suffix, the value is too large for `int`, even if the destination variable is declared `long`.
Learn when an integer literal is an `int` or a `long`, how to write large values, and why `0L` is useful for running totals and conversions to `Long`.
`0L` is zero of type `long`, while `0` is zero of type `int`. That difference matters for overload selection, arithmetic, and defaults that must be `Long`.
A local class is a named nested class declared, for example, in a method block. The scope of its name does not limit the lifetime of its instances.
Method overloading lets several methods share a name while using different parameter lists. The compiler selects an overload using the arguments and their compile-time types, rather than the runtime classes of argument objects.
The catch (A | B e) syntax handles different exception types in one block. Alternative types must not have a subtype relationship, and the parameter e is implicitly final.
Distinguish static nested classes from inner classes, expose builder steps through public interfaces, and give a nested LRU cache its own type parameters.
Raw `List` and `ArrayList` bypass compile-time element-type checks. Assigning a raw list to `List<String>` neither validates its contents nor recovers a type argument.
In Java SE 21, a record’s compact canonical constructor validates or normalizes arguments before Java assigns their values to the component fields.