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

default — fallback branch or implementation

default — fallback branch or implementation: default marks an unmatched switch branch, an interface method with an implementation, or an annotation element’s default value.

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

do — post-test loop

do — post-test loop: A do statement executes its body before testing the boolean expression after while, so the body runs at least once.

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

else — alternative if branch

else — alternative if branch: else supplies the alternative statement for the nearest preceding if whose boolean condition evaluated to false.

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

enum — enumeration type declaration

enum — enumeration type declaration: enum declares an enum class with a finite set of instances; each constant may take arguments and have a constant-specific class body that overrides behavior.

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

exports — module package export

exports — module package export: An exports directive in module-info.java gives other modules access to a package’s public top-level types. Public or protected members and nested types remain subject to the ordinary access-control rules.

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

extends — inheritance and upper bounds

extends — inheritance and upper bounds: extends names a class’s direct superclass, an interface’s direct superinterfaces, or the upper bound of a type parameter or wildcard.

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

final — restriction on further change

final — restriction on further change: final restricts change: a variable can be assigned once, a method cannot be overridden, and a class cannot be subclassed.

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

finally — cleanup after try

finally — cleanup after try: A finally clause belongs to try and runs after the try block and any selected catch when control completes them normally or by most abrupt-completion reasons.

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

for — basic and enhanced loops

for — basic and enhanced loops: The for statement is either basic with initialization, condition, and update, or enhanced for, which successively assigns elements from an array or Iterable.

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

goto — reserved unused keyword

goto — reserved unused keyword: goto is a reserved but unused Java keyword: the parser accepts it neither as an identifier nor as a jump statement.

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

if — conditional selection

if — conditional selection: An if statement selects a branch from a boolean expression; an optional else belongs to the nearest unmatched if unless braces change the structure.

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

implements — implementing interfaces

implements — implementing interfaces: An implements clause on a class or record declaration lists direct superinterfaces; a concrete class must provide inherited abstract methods.

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

import — names from other packages

import — names from other packages: An import declaration in a compilation unit makes a type or static member available by simple name; it neither loads a class at runtime nor creates an alias.

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

interface — type contracts

interface — type contracts: An interface declaration defines a reference type with member contracts; fields are public static final, while methods may be abstract, default, static, or private.

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

module — JPMS module declaration

module — JPMS module declaration: module is a contextual keyword that begins a module declaration in module-info.java; outside that context it may be an ordinary identifier.

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

native — method outside Java

native — method outside Java: The native modifier declares a method implemented outside the Java language; the declaration ends with a semicolon and has no Java body.

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

new — creating objects and arrays

new — creating objects and arrays: The new operator creates a class instance through a class instance creation expression or creates an array; for a class it allocates the object and then runs the selected constructor.

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

The keyword non-sealed

The keyword non-sealed: The non-sealed modifier reopens a class or interface that is a direct permitted subtype of a sealed type.

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

The keyword open

The keyword open: The open modifier on a module declaration opens every package for deep run-time reflection without exporting those packages.

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

The keyword opens

The keyword opens: The opens directive opens one module package for deep run-time reflection, optionally only to modules named after to.

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

The keyword package

The keyword package: A package declaration assigns at most one package name to an ordinary compilation unit and namespaces its top-level types.

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

The keyword permits

The keyword permits: A permits clause lists the direct classes or interfaces allowed to extend the declared sealed type.

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

The keyword private

The keyword private: The private modifier restricts a member to the body of its declaring top-level class and that class’s nestmates.

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

The keyword protected

The keyword protected: The protected modifier exposes a member within its package and to subclass code under special inherited-access rules.

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