Token
The smallest individual unit in a program is known as a token. In fact, every unit that makes a sentence is a token.
Java has the following token:
- Keywords
- Identifiers
- Literals
- Punctuators
- Operators
Keywords
Keywords are the words that convey a special meaning to the language compiler. These are reserved for special purposes and must not be used as normal identifier names.
The following character sequences, formed from ASCII letters, are reserved for use as keywords and cannot be used as identifiers:
abstract | default | if | private | this |
boolean | do | implements | protected | throw |
break | double | import | public | throws |
byte | else | instanceof | return | transient |
case | extends | int | short | try |
catch | final | interface | static | void |
char | finally | long | strictfp | volatile |
class | float | native | super | while |
const | for | new | switch | |
continue | goto | package | synchronized |
The keywords const and goto are reserved, even though they are currently not in use. This may allow a Java compiler to produce better error messages if these Java Keywords incorrectly appear in programs.
While true and false might appear to be keywords, they are technically boolean literals. Similarly, while null might appear to be a keyword, it is technically the null literal. Thus true, false and null are not keywords but reserved words.
Note: also read about the Simple Hello World Program
Follow Me
If you like my post please follow me to read my latest post on programming and technology.
https://www.instagram.com/coderz.py/
https://www.facebook.com/coderz.py
Staying up to the mark is what defines me. Hi all! I’m Rabecca Fatima a keen learner, great enthusiast, ready to take new challenges as stepping stones towards flying colors.
Leave a Comment