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):

abstractassertboolean
breakbytecase
catchcharclass
constcontinuedefault
dodoubleelse
enumextendsfinal
finallyfloatfor
gotoifimplements
importinstanceofint
interfacelongnative
new package private
protectedpublicreturn
shortstaticstrictfp
superswitchsynchronized
thisthrowthrows
transienttryvoid
volatilewhilevar
recordyield 
 

Some noteworthy points regarding Java keywords:

 

And based on categories, the keywords in Java can be grouped as follows:

 



Java keywords for access modifiers: privateprotected, public

Java keywords for class, method, variable modifiers:

abstractclassdefaultextendsfinal

implementsinterfacenativenew

staticstrictfpsynchronizedtransient

var, recordvolatile

 

Java keywords for Flow control:

breakcasecontinuedefaultdoelse

forifinstanceofreturnswitchwhile,

yield

 

Java keywords for package control: importpackage

 

Java keywords for primitive types: booleanbytechar

doublefloatintlongshort

 

Java keyword for error handling: assertcatchfinally

throwthrowstry

 

Java keyword for enumeration: enum

Other Java keywords:  superthisvoid

Unused (reserved) Java keywords: const, goto 

 

Other Recommended Tutorials:


About the Author:

is certified Java programmer (SCJP and SCWCD). He started programming with Java in the time of Java 1.4 and has been falling in love with Java since then. Make friend with him on Facebook and watch his Java videos you YouTube.