I'm always excited to take on new projects and collaborate with innovative minds.

Email

contact@niteshsynergy.com

Website

https://www.niteshsynergy.com/

Java

java-keywords-use

✅ Java Keywords Till Java 5 (Java 1.0 to 1.5)

  • abstract – Used to declare a class or method as abstract (i.e., incomplete, to be implemented by subclass).

  • assert – Used to test assumptions in code; throws error if condition is false (mainly for debugging).

  • boolean – Primitive data type that holds true or false.

  • break – Exits from a loop or switch block.

  • byte – Primitive data type (8-bit signed integer).

  • case – Defines individual conditions inside a switch statement.

  • catch – Used to catch exceptions from a try block.

  • char – Primitive data type (16-bit Unicode character).

  • class – Used to declare a class.

  • const – Reserved keyword, not used in Java.

  • continue – Skips the current iteration in loops and jumps to the next.

  • default – Defines the default block in a switch or default method implementation in interfaces.

  • do – Starts a do-while loop.

  • double – Primitive data type for 64-bit decimal values.

  • else – Executes block when if condition is false.

  • enum – Introduced in Java 5 to define a fixed set of constants.

  • extends – Indicates inheritance (class or interface extension).

  • final – Used to declare constants, prevent method overriding or inheritance.

  • finally – Block that always executes after try-catch.

  • float – Primitive data type for 32-bit decimal values.

  • for – Loop construct for iteration.

  • goto – Reserved keyword, not implemented.

  • if – Executes block based on condition.

  • implements – Declares that a class implements an interface.

  • import – Imports classes or packages.

  • instanceof – Checks if an object is an instance of a class.

  • int – Primitive data type (32-bit signed integer).

  • interface – Defines an abstract type with method signatures.

  • long – Primitive data type (64-bit signed integer).

  • native – Indicates method is implemented in native code (e.g., C/C++).

  • new – Creates new objects.

  • package – Defines the package of a class.

  • private – Access modifier: only within the class.

  • protected – Access modifier: class, package, and subclass.

  • public – Access modifier: accessible from everywhere.

  • return – Returns a value from a method.

  • short – Primitive data type (16-bit signed integer).

  • static – Defines class-level fields or methods.

  • strictfp – Ensures consistent floating-point calculations across platforms.

  • super – Refers to superclass constructor or methods.

  • switch – Allows multi-branch conditional execution.

  • synchronized – Ensures only one thread can execute a block/method at a time.

  • this – Refers to the current object.

  • throw – Throws an exception.

  • throws – Declares exceptions a method can throw.

  • transient – Prevents serialization of a field.

  • try – Defines block to test code for exceptions.

  • void – Declares that a method does not return anything.

  • volatile – Ensures changes to a variable are visible to all threads.

  • while – Starts a while loop.


✅ Next: Java 6 & 7

No new keywords were introduced in Java 6 or Java 7. Only new features (like try-with-resources, strings in switch, etc.) — but no new reserved words.

 

✅ Java 8 Keywords (2014)

Java 8 introduced major features like lambdas and streams, but no new keywords were added.

👉 Functional interfaces, :: method references, -> lambda syntax — all added, but these are not reserved keywords.


✅ Java 9 to Java 12 — No new keywords

  • Java 9 (2017): Modules introduced (module-info.java) — but no new keywords.

  • Java 10–12: Added features like var (in Java 10), but let’s break it down below.


✅ Java 10 Keyword (2018)

  • var – Introduced for local variable type inference.
    Example: var name = "Nitesh";
    Java infers that name is of type String.


✅ Java 11, 12 – No new keywords

  • Java 11: Introduced enhancements like var in lambda parameters, HttpClient, etc.

  • Java 12: Switch expression preview — no new keywords, just syntax improvements.


✅ Java 13 to 14 – Still no new keywords

  • Java 14 introduced:

    • record (preview) — not yet a keyword.

    • Pattern matching (preview)
      These were not keywords yet — just preview features.


✅ Java 15 Keyword (2020)

  • sealed – Used to restrict class inheritance.
    Example: public sealed class Shape permits Circle, Square {}


✅ Java 16 Keyword (2021)

  • permits – Used with sealed classes to specify which classes can extend them.
    Example: sealed class A permits B, C {}

  • record – Became a full keyword in Java 16. Used to declare data-carrying immutable classes.
    Example: record User(String name, int age) {}


✅ Java 17 – No new keywords

Java 17 was a Long Term Support (LTS) release.
Many preview features like pattern matching improved — but no new keywords added.


✅ Java 18 – No new keywords

This release focused on incubation features, performance, and simple web server — no keyword changes.


✅ Java 19 Keyword (Preview)

  • non-sealed – Used to opt-out of sealing in a class hierarchy.
    Example:

    java
    sealed class A permits B, C {} non-sealed class B extends A {}

    Became a preview feature here and finalized in Java 21.


✅ Java 20 – No new keywords

Features like record patterns and scoped values were previewed, but no new keywords added.


✅ Java 21 Keywords (2023)

Java 21 finalized many keywords introduced in earlier previews:

  • sealed – Finalized.

  • permits – Finalized.

  • non-sealed – Finalized.

These keywords are now part of the official Java syntax.


🔚 Final Java Keywords List as of Java 21

In total, Java 21 has 57 reserved keywords:

  • From Java 1.0 – 50 core keywords

  • Java 5 – enum

  • Java 10 – var

  • Java 15 – sealed

  • Java 16 – record, permits

  • Java 21 – non-sealed (finalized)

 

 

4 min read
Jun 12, 2025
By Nitesh Synergy
Share

Leave a comment

Your email address will not be published. Required fields are marked *