Java Reference
In-Depth Information
machine-independent programming went beyond the obvious problems
of hardware incompatibility. In the rapidly-evolving world of personal
computers, operating systems were also changing at a fast rate. In the
1990's the same machine could run a half dozen versions of MS DOS, Win-
dows 3.0/3.1, Windows 95, Windows 98, Windows 2000, NT 3.1, 3.5, 4.0, or
Windows CE, and Linux. Applications had to be constructed taking into
account many variations in the system software. At the same time, many
potential customers were lost when an application was limited to a single
machine or operating system environment.
Making an application compatible with several machine and software
configurations often ends in a programming nightmare. Java promises a
simplification of the programming task and a solution to incompatibility
problems. No longer does the programmer have to deal with a “moving
target” of hardware and operating system software. Instead, Java's “Code
once, run anywhere” motto promises that the code can be “future proof”
by making it compatible with future machines and operating systems.
Java as a Programming Language
One reason for Java's success is that if you already know C or C++, Java is
easy to learn. By the same token, if you learn Java as your first language,
you will later be able to pick up C and C++ without much effort. Java is de-
scribed as an interpreted, object-oriented, strongly typed language that re-
lies heavily on support libraries. These characteristics of Java are
discussed in the following sections.
Java is object-oriented
An object is a program element that contains both data and code. The ratio-
naleforobjectsisthatdataisusefulifthereareoperationsthatcanbeused
to transform it. For example, we find it useful to store numbers in a com-
puter system because there are operations that can be performed on these
numbers. A computer program stores the hourly wage of a company's em-
ployees because it can later calculate the gross pay of each individual by
multiplying the hourly wage by the number of hours worked. What use
would it be to store numbers in a computer system that cannot perform
arithmetic?
Object-oriented programming (OOP) views a software system as a col-
lection of classes of objects. Each object class is a self-contained unit of
data and the processing operations that can be applied to this data. You
can image a payroll program that contains a class called Wage-
EarningEmployee. The objects of the class are the individual wage earn-
ers employed by the company. In this sense Joe Smith, who makes wages
Search WWH ::




Custom Search