Keyword in Java
What is Keyword in Java?
Key + word means a word having crucial importance. In Java programming language keywords are reserved words having predefined meaning.
- There are total 50 keywords in Java.
- These words are nothing but 50 character sequences, formed from ASCII letters, are reserved for use as keywords.
- These keywords can not be used as identifiers.
Keywords
abstract | continue | for | new | switch |
assert | default | if | package | synchronized |
boolean | do | goto | private | this |
break | double | implements | protected | throw |
byte | else | import | public | throws |
case | enum | instanceof | return | transient |
catch | extends | int | short | try |
char | final | interface | static | void |
class | finally | long | strictfp | volatile |
const | float | native | super | while |
- The keywords const and goto are reserved, even though they are not currently used. This may allow a Java compiler to produce better error messages if these C++ keywords incorrectly appear in programs.
- true, false, and null might seem like keywords, but they are actually literals; you cannot use them as identifiers in your programs.