In this tutorial, you’ll learn about Java Keywords which reserved and cannot be modified Java Programming.
The Java programming language has the total of 50 reserved keywords which have special meaning for the compiler and cannot be used as variable names.
The Following is a list of all Java keywords in alphabetical order, click on an individual keyword to see its description and usage example.
abstract | assert | boolean | break | byte |
case | catch | char | class | const |
continue | default | do | double | else |
enum | extends | final | finally | float |
for | goto | if | implements | import |
instanceof | int | interface | long | native |
new | package | private | protected | public |
return | short | static | strictfp | super |
switch | synchronized | this |
throw | throws |
transient | try | void | volatile | while |
Some noteworthy points regarding Java keywords:
- const and goto are reserved words but not used.
- true, false and null are literals, not keywords.
- all keywords are in lower-case.
The following table shows the keywords grouped by category used in Java:
Category | Keywords |
Access modifiers | private, protected, public |
Class, method, variable modifiers | abstract, class, extends, final, implements, interface, native, new, static, strictfp, synchronized, transient, volatile |
Flow control | break, case, continue, default, do, else, for, if, instanceof, return,switch, while |
Package control | import, package |
Primitive types | boolean, byte, char, double, float, int, long, short |
Error handling | assert, catch, finally, throw, throws, try |
Enumeration | enum |
Others | super, this, void |
Unused | const, goto |
- goto and const – are not used
- enum – is present since Java 5.0
- strictfp – is present since Java 1.2
- assert – is present since Java 1.4
- In addition, the identifiers null, true and false denote literal values and may not be used to create identifiers.
Recommended Book: Beginning Programming with Java For Dummies (Cover Java 7)
Ask your questions and clarify your/others doubts on Java Keywords by commenting. Java Documentation.
PREVIOUS JAVA COMMENTS |
NEXT JAVA NAMING CONVENTION |