Java中的关键字向编译器传达了特殊的含义,因此,这些关键字不能用作标识符。Java提供了一组50个关键字。
| abstract | continue | for | new | switch |
| assert | default | goto | package | synchronized |
| boolean | do | if | private | this |
| break | double | implements | protected | throw |
| byte | else | import | public | throws |
| case | enum | instanceof | return | transient |
| catch | extends | int | short | try |
| char | final | long | strictfp | volatile |
| const | float | native | super | while |
在上述关键字列表中,关键字goto和const当前未使用。它们是保留字(供将来使用)。