1. Home
  2. Computing & Technology
  3. Java

Identifier

By , About.com Guide

Definition:

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., "$").
Examples:

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);

Glossary:

# 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

Explore Java
About.com Special Features

The Best Web Trends of the Decade

A look back at the best innovations, ideas and technologies over the last 10 years, More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Java
  4. Java Glossary
  5. I
  6. Identifier - Definition for the Java Term: Identifier>

©2009 About.com, a part of The New York Times Company.

All rights reserved.