您的位置:寻梦网首页编程乐园Java天地Core JavaJava Lecture Notes
Introduction
Content
Apply
Reflect
Extend
previous.gif
 (3087 bytes)
next.gif
 (2959 bytes)

 
 
Content Index
Content Page # 6

Variables

Variables store values. Variables have a name, a type, and a value.

For example, in a program concerned with company accounts, we may define a class called Customer, representing and managing the details of the company's customers. Variables of Customer may include name, address, credit limit, etc. Each object of class customer may have different values of these variables.

Taking the 'Customer' example, let's assume that the important features of a customer are name, address, account balance and credit limit. We might define this as below:

class Customer
    {
         // Variables of customer
String name;
String address;
int accountBalance;
int creditLimit;
// Methods of Customer go here
      }
Back to top

basicline.gif (169 bytes)

RITSEC - Global Campus
Copyright © 1999 RITSEC- Middlesex University. All rights reserved.
webmaster@globalcampus.com.eg