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

try-with-resources — automatic resource closing

The try-with-resources statement automatically calls close() on AutoCloseable resources. It defines their usage lifetime and specifies how closing exceptions are handled.

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

Generic type erasure in Java

Java checks type arguments at compile time, but `ArrayList<String>` and `ArrayList<Integer>` do not have separate runtime classes. This distinction explains restrictions on arrays and `instanceof`.

Basic · Java SE 21
Java

Java varargs: String... and T...

In Java SE 21, a varargs parameter accepts separate arguments or an existing array. With `T...`, type erasure also introduces a risk of heap pollution.

Advanced · Java SE 21
Java

Wildcard capture in Java

A private `<T>` helper lets you swap two elements of the same `List<?>` without a cast or exposing the element type in the public method signature.

Intermediate · Java SE 21
Java

Wildcard type arguments in Java

Learn what `?`, `? extends T`, and `? super T` let you read or write, and how Java SE 21 applies those rules to lists, arrays, class tokens, and reference queues.

Basic · Java SE 21
Java

Arrays: T[] and new T[n]

A Java array is a fixed-length object storing elements of one component type. Learn the T[] declaration, creation with new T[n], zero-based indexing, and shared references.

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

The boolean type and Boolean wrapper class

boolean is a primitive type with two values: true and false. It stores conditions and comparison results. Boolean is its wrapper class; a variable of this type can also hold null, which requires care when automatic unboxing occurs.

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

byte — signed 8-bit integer type

The primitive byte type stores integers from -128 to 127. Learn the limits Byte.MIN_VALUE and Byte.MAX_VALUE, the distinction between byte and Byte, promotion to int, and the effects of a narrowing cast.

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

char — a UTF-16 code unit

char is an unsigned primitive integral type that stores one 16-bit UTF-16 code unit. That unit does not necessarily represent a complete Unicode character; characters outside the BMP require a pair of char values.

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

Character — the char wrapper and Unicode operations

Character is an immutable wrapper for primitive char values. It also provides static methods for recognizing letters and converting case, with overloads for char values and int code points.

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

double — double-precision floating-point numbers

double is Java's primitive 64-bit IEEE 754 binary64 floating-point type. Learn its precision limits, how it differs from Double, and the rules for comparison, maximum selection, and hashing.

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

float — single-precision floating-point type

float is a Java primitive numeric type based on the 32-bit IEEE 754 binary32 format. It stores approximations of many fractions. Float is its wrapper class, not an alternative spelling of the same type.

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

int — 32-bit signed integer type

int is a primitive signed integer type in Java SE 21. Its range is fixed; integer division normally discards the fractional part, and overflow does not throw an exception.

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

Integer — the object wrapper for int

Integer wraps an int value in an object. Learn creation with valueOf, boxing and unboxing, the sum, max, compare, equals and hashCode methods, and why to avoid the Integer(int) constructor.

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

long — 64-bit integer and the Long wrapper

The primitive long type stores signed 64-bit integers. Learn the L suffix, the difference between long and Long, and the rules for value equality and hash codes.

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

Multidimensional array

A multidimensional array in Java is an array of arrays. T[][] denotes two levels: the outer array stores references to rows, which may have different lengths or be null.

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

Number — a common base class for numeric objects

Number is an abstract base class for numeric objects such as Integer. It provides conversion methods to primitive types, including intValue() and doubleValue(); details and potential information loss depend on the subclass.

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

Object — the common base class of objects

Object is the root of Java's class hierarchy. Learn the difference between a reference type and an object's class, and how getClass(), wait(), and notifyAll() work with a monitor.

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

short — signed 16-bit integer type

short is a signed primitive integer type ranging from -32768 to 32767. Learn how it differs from the Short wrapper class, why arithmetic promotes it to int, and how narrowing can lose information.

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

String — immutable text

String represents immutable text in Java. Learn content versus reference comparison, value conversion, regular expressions, and explicit byte encoding and decoding.

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

void — a method with no return value

The `void` keyword indicates that a method returns no value. The method can still perform actions, such as printing text. Do not confuse `void` with the value `null` or with the `java.lang.Void` class.

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