1. Home
  2. Computing & Technology
  3. Java

Variable

By , About.com Guide

Definition:

A variable is a container that holds values that are used in a Java program. Every variable must be declared to use a data type. For example, a variable could be declared to use one of the eight primitive data types: byte, short, int, long, float, double, char or boolean. And, every variable must be given an initial value before it can be used.

Examples:
int myAge = 21;

The variable "myAge" is declared to be an int data type and initialized to a value of 21.

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

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. 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. V
  6. Variable - Definition for the Term: Variable>

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

All rights reserved.