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

Distributed Transactions

What is a distributed transaction?  Transactions that span over multiple physical systems or computers over the network, are simply termed D...