Java Tokens
A java programes is basically a collection of classes. A class is defined by a set of declaration statements and methods containing executable statements. Most statements contain expression which describe the actions carried out on data. Smallest individual units in a program are know as token. The compiler recognizes them for building up expressions and statements.
In a simple terms, a java program is a collection of tokens, comments and white spaces. Java language includes five type of token.- Reserved Keyword
- Identifiers
- Literals
- Operators
- Separators
Reserved Keyword:
Keywords are an essential part of language definition. Keywords are the words whis defination is already known to java. They implements specific featues of language. Java has 50 reserved keyword.
These keywords, combined with operators and separators according to syntax, from definiton of java language. These keywords have some specific meaning in java, we can not use as names for variables, method, classes and so on. All keywords should be written in lower-case letters.
Identifiers:
Identifiers are programmer-design tokens. They are use for naming classes, methods, variabels, objects, labels, package and interfaces in program. Java identifiers should follow some rule those are:
- They can have alphabets, digits, underscore and dollar sign charactors.
- They must not being with a digit.
- Uppercase and lowercase letters are distinct.
- They can be of any length.
- Integer literals
- Floating_point literals
- Character literals
- String literals
- Boolean literals
Comments
Post a Comment