Computer Applications
What are identifiers in Java? List three identifier formation rules.
Answer
Identifiers are used to name different parts of a program such as variables, methods, classes, objects, etc. Three identifier formation rules are:
- An an identifier can be a sequence of alphabets, digits, underscore and dollar sign characters only.
- Identifiers cannot start with a digit.
- An identifier must not be a Keyword or a Boolean or null literal.
Related Questions
Explain the following statement — "In Java, total, Total, ToTaL, and TOTAL are all different identifiers."
Why can a keyword not be used as a variable name?
Which of the following are Java keywords?
area, input, class, public, int, x, y, radius, long, Hello javaWhich of the following are invalid identifiers?
i. ten
ii. "Hello"
iii. 5678
iv. Coffee
v. $dollar
vi. 4Variables
vii. _var