Tuesday, December 10, 2013

Identifiers in Java

Identifiers are the names of variables, methods, classes, packages and interfaces. Unlike literals they are not the things themselves, just ways of referring to them.
In the HelloWorld program, HelloWorldStringargsmain and println are identifiers.



In Java, there are several points to remember about identifiers. They are as follows:
  1. All identifiers should begin with a letter (A to Z or a to z), currency character ($) or an underscore (_).
  2. After the first character identifiers can have any combination of characters.
  3. A key word cannot be used as an identifier.
  4. Most importantly identifiers are case sensitive.
  5. Examples of legal identifiers: age, $salary, _value, __1_value
  6. Examples of illegal identifiers: 123abc, -salary

No comments:

Post a Comment

How to build an AI Agent

  Agents are the most valuable skill in AI and product right now. So why not build one? Here's how: π’π­πžπ© 𝟏: πƒπžπŸπ’π§πž 𝐚 𝐬𝐲𝐬...