1. Technology
Send to a Friend via Email



Woman working on her laptop at her desk
2A Images/

An identifier is a name given to a package, class, interface, method, or variable. It allows a programmer to refer to the item from other places in the program. To make the most out of the identifiers you choose make them meaningful and follow the standard Java naming conventions.

Three things to remember when choosing an identifier:

  • reserved words cannot be used.
  • they cannot start with a digit but digits can be used after the first character (e.g., name1, n2ame are valid).
  • the only symbols you can use are the underscore (i.e., "_") and dollar sign (i.e., "$").

If you have variables that hold the name, height and weight of a person then choose identifiers that make their purpose obvious:

 String name = "Homer Jay Simpson";
 int weight = 300;
 double height = 6;
 System.out.printf("My name is %s, my height is %.0f foot and my weight is %d pounds. D'oh!%n", name, height, weight); 


# A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
  1. About.com
  2. Technology
  3. Java
  4. Java Glossary
  5. I
  6. Definition for the Java Term Identifier

©2014 About.com. All rights reserved.