- A name in a program is called an identifier.
- An identifier is sequence of characters which can be a letter, digit, connecting characters (Underscore _) or a currency symbol ($, ¢, ¥ or £).
- Identifier cannot start with a digit, after first character digits are allowed.
- Identifiers in java are case sensitive i.e. test and Test are two different Identifiers.
- Identifier can be of any length
- Keywords cannot be used as an Identifier.
Illegal Identifier
- 45abcd – Starting with a digit
- abcd@efgh – @ is not allowed
- new – Keyword not allowed
- $$ – $ is allowed
- Ab88cd – Digits are allowed after first character.
- Abc_88 – Underscore is a valid connecting character.
No comments:
Post a Comment