Last Updated on 09 March 2024   |   Print Email
This article gives you an overview of all keywords in the Java programming language with explanation and code examples (updated to Java 14). Understand the meaning of each Java keyword will help you write better and more precise code, e.g. know when to use public or private for a variable or class.Beginners in Java programming will find the list below helpful in terms of getting started with Java from the ground up. And senior Java programmers will also find this article helpful in terms of reviewing all Java keywords updated to the most recent release of Java.You know, the Java programming language has over 50 reserved keywords which have special meaning for the compiler and cannot be used as variable names. Following is a list of Java keywords in alphabetical order. You can click on an individual keyword to see its description and usage example.
List of all keywords in Java (updated to Java 14):
Since Java 8, the default keyword is also used to declare default methods in interfaces.
Since Java 10, the word var is used to declare local variables (local variables type inference). For backward compatibility, you can still use var as variable names. So var is a reserved word, not keyword.
Java 14 adds two new keywords record and yield (but in preview mode)
all keywords are in lower-case.
And based on categories, the keywords in Java can be grouped as follows:
Nam Ha Minh is certified Java programmer (SCJP and SCWCD). He began programming with Java back in the days of Java 1.4 and has been passionate about it ever since. You can connect with him on Facebook and watch his Java videos on YouTube.
Comments