Java Keywords

Java extends Keyword

The extends keyword in Java is used to indicate that a class is inheriting from another class. It establishes an inheritance relationship where a subclass (child class) inherits fields and methods from a superclass (parent class). This mechanism allows for code reuse, method overriding, and polymorphism.

Java import Keyword

The import keyword in Java is used to bring classes, interfaces, or entire packages into the current file so that their members can be accessed without needing to fully qualify their names. This makes the code more readable and easier to maintain by reducing redundancy.

Java strictfp Keyword

The strictfp keyword in Java is used to restrict floating-point calculations to ensure consistent and platform-independent results. When a class, method, or interface is declared with strictfp, all floating-point computations within its scope are performed using strict floating-point rules, which adhere to the IEEE 754 standard for floating-point arithmetic.

Java non-sealed Keyword

The non-sealed keyword in Java is used to declare that a class or interface that extends or implements a sealed class or interface is open to further subclassing. This feature, introduced in Java 17, allows for flexibility in extending a class hierarchy that would otherwise be restricted by the sealed keyword.

Java provides Keyword

The provides keyword in Java is part of the Java Platform Module System (JPMS) introduced in Java 9. It is used within a module declaration to specify that the module provides an implementation of a service interface. This keyword is paired with the with keyword to declare the specific implementation class.

Java uses Keyword

The uses keyword in Java is part of the Java Platform Module System (JPMS) introduced in Java 9. It is used within a module declaration to specify that the module depends on a service interface. This keyword indicates that the module will use a service provider that implements the specified service interface.

Java requires Keyword

The requires keyword in Java is used within a module definition to specify module dependencies. It indicates that the current module depends on another module to function correctly. This is part of the Java Platform Module System (JPMS), introduced in Java 9, which provides a way to modularize Java applications and libraries.

Java exports Keyword

The exports keyword in Java is used within a module definition to make a package accessible to other modules. This is part of the Java Platform Module System (JPMS), introduced in Java 9, which provides a way to modularize Java applications and libraries.

Java module Keyword

The module keyword in Java is used to define a module, which is a named, self-describing collection of code and data. This feature was introduced in Java 9 as part of the Java Platform Module System (JPMS). Modules help to encapsulate and manage dependencies in large applications.

Java volatile Keyword

The volatile keyword in Java is used to indicate that a variable’s value will be modified by different threads. It ensures that changes made to a variable in one thread are immediately visible to other threads, thus providing a lightweight synchronization mechanism.

Scroll to Top