Below is the list of all reserved words in java :-
Category | Keywords |
---|---|
Data Types |
boolean , char , byte , short , int , long , float , double ,
|
Control Statements |
if , else , switch , case , default ,
for , while , do , break , continue
|
Class/Interface |
class , interface , enum , extends , implements
|
Object Management | new , this , super , null |
Modifiers |
abstract , final , static , synchronized ,
transient , volatile
|
Package Management | package , import |
Access Modifiers | public , private , protected |
Return Type | void , return |
Exception Handling |
try , catch , finally , throw , throws ,
assert
|
Synchronization | synchronized |
Others |
native , strictfp , boolean , instanceof
|
Not Used |
goto , const
|
true
, false
and null
are not keywords, they are literals (reserved words).
var
, yield
, record
, sealed
and non-sealed
.
So total there are 57 reserved words including 5 contextual keywords in Java.
class
is a keyword, but Class
is not).
Your feedback helps us grow! If there's anything we can fix or improve, please let us know.
Weโre here to make our tutorials better based on your thoughts and suggestions.