2.3. Keywords
Table 2-3 contains the Java keywords. Two of them are reserved but not used by the Java language: const and goto. These C++ keywords are included as Java keywords to generate better error messages if they are used in a Java program. Java 5.0 introduced the enum keyword.
| Java keywords cannot be used as identifiers in a Java program. |
|
Table 2-3. Java keywords
| abstract | double | int | super |
| assert | else | interface | switch |
| boolean | enum | long | synchronized |
| break | extends | native | this |
| byte | final | new | throw |
| case | finally | package | throws |
| catch | float | private | transient |
| char | for | protected | try |
| class | if | public | void |
| const | goto | return | volatile |
| continue | implements | short | while |
| default | import | static | |
| do | instanceof | strictfp | |
| Sometimes true, false, and null literals are mistaken for keywords. They are not keywords; they are reserved literals. |
|
No comments:
Post a Comment