10x Blogs Directory

Thursday, February 19, 2009

Identifiers

  • Identifiers
    -are tokens that represent names of variables, methods, classes, etc.
    -Examples of identifiers are: Hello, main, System, out.
  • Java identifiers are case-sensitive.
    -This means that the identifier Hello is not the same as hello.
  • Identifiers must begin with either a letter, an underscore “_”, or a dollar sign “$”. Letters may be lower or upper case. Subsequent characters may use numbers 0 to 9.
  • Identifiers cannot use Java keywords like class, public, void, etc. We will discuss more about Java keywords later.


Coding Guidelines:

  • For names of classes, capitalize the first letter of the class name. For example,
    ThisIsAnExampleOfClassName
  • For names of methods and variables, the first letter of the word should start with a small letter. For example,
    thisIsAnExampleOfMethodName
  • In case of multi-word identifiers, use capital letters to indicate the start of the word except the first word. For example,
    charArray, fileNumber, ClassName.
  • Avoid using underscores at the start of the identifier such as _read or _write.