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
RITSEC - Global Campus
Copyright © 1999 RITSEC- Middlesex
University. All rights reserved.
webmaster@globalcampus.com.eg
|