Java concepts 5th Edition Cay S. Horstmann download
Java concepts 5th Edition Cay S. Horstmann download
or textbooks at https://ebookultra.com
https://ebookultra.com/download/java-concepts-5th-edition-
cay-s-horstmann/
https://ebookultra.com/download/java-concepts-5-pap-onl-edition-cay-
horstmann/
https://ebookultra.com/download/brief-java-early-objects-9th-edition-
cay-horstmann/
https://ebookultra.com/download/big-java-compatible-with-
java-5-6-and-7-4th-edition-cay-s-horstmann/
https://ebookultra.com/download/python-for-everyone-2nd-edition-cay-
horstmann-rance-necaise/
Core Java Volume 1 Fundamentals 8th ed Edition Horstmann
https://ebookultra.com/download/core-java-volume-1-fundamentals-8th-
ed-edition-horstmann/
https://ebookultra.com/download/operating-systems-concepts-with-
java-6th-edition-silberschatz/
https://ebookultra.com/download/java-tm-programming-from-problem-
analysis-to-program-design-5th-edition-d-s-malik/
https://ebookultra.com/download/the-java-tutorial-a-short-course-on-
the-basics-5th-edition-java-series-zakhour/
https://ebookultra.com/download/the-java-ee-6-tutorial-basic-
concepts-4th-edition-eric-jendrock/
Java concepts 5th Edition Cay S. Horstmann Digital
Instant Download
Author(s): Cay S. Horstmann
ISBN(s): 9780470105559, 0470105550
Edition: 5
File Details: PDF, 10.80 MB
Year: 2007
Language: english
Java Concepts, 5th Edition
Java Concepts
FIFTH EDITION
Cay Horstmann
978-0-470-10555-9
Chapter 5 Decisions 1
226
Chapter 6 Iteration
Chapter 10 Inheritance
Chapter 1 Introduction
CHAPTER GOALS
• To understand the activity of programming
The purpose of this chapter is to familiarize you with the concept of programming. It
reviews the architecture of a computer and discusses the difference between machine
code and high-level programming languages. Finally, you will see how to compile
and run your first Java program, and how to diagnose errors that may occur when a
program is compiled or executed.
2
1.1 What Is Programming?
You have probably used a computer for work or fun. Many people use computers for
everyday tasks such as balancing a checkbook or writing a term paper. Computers are
good for such tasks. They can handle repetitive chores, such as totaling up numbers or
placing words on a page, without getting bored or exhausted. Computers also make
good game machines because they can play sequences of sounds and pictures,
involving the human user in the process.
The flexibility of a computer is quite an amazing phenomenon. The same machine can
balance your checkbook, print your term paper, and play a game. In contrast, other
machines carry out a much narrower range of tasks—a car drives and a toaster toasts.
To achieve this flexibility, the computer must be programmed to perform each task. A
computer itself is a machine that stores data (numbers, words, pictures), interacts with
devices (the monitor screen, the sound system, the printer), and executes programs.
Chapter 1 Introduction Page 1 of 43
Java Concepts, 5th Edition
Programs are sequences of instructions and decisions that the computer carries out to
achieve a task. One program balances checkbooks; a different program, perhaps
designed and constructed by a different company, processes words; and a third
program, probably from yet another company, plays a game.
Today's computer programs are so sophisticated that it is hard to believe that they are
all composed of extremely primitive operations.
A computer program tells a computer, in minute detail, the sequence of steps that are
needed to complete a task. A program contains a huge number of simple operations,
and the computer executes them at great speed. The computer has no intelligence—it
simply executes instruction sequences that have been prepared in advance.
A computer program contains the instruction sequences for all tasks that it can
execute.
A primary purpose of this book is to teach you how to design and implement computer
programs. You will learn how to formulate instructions for all tasks that your programs
need to execute.
Many students find that there is an immense thrill even in simple programming tasks.
It is an amazing experience to see the computer carry out a task precisely and quickly
that would take you hours of drudgery.
SELF CHECK
1. What is required to play a music CD on a computer?
At the heart of the computer lies the central processing unit (CPU) (see Figure 1). It
consists of a single chip (integrated circuit) or a small number of chips. A computer
chip is a component with a plastic or metal housing, metal connectors, and inside
wiring made principally from silicon. For a CPU chip, the inside wiring is enormously
complicated. For example, the Pentium 4 chip (a popular CPU for personal computers
at the time of this writing) contains over 50 million structural elements called
transistors—the elements that enable electrical signals to control other electrical
signals, making automatic computing possible. The CPU locates and executes the
program instructions; it carries out arithmetic operations such as addition, subtraction,
multiplication, and division; and it fetches data from storage and input/output devices
and sends data back.
At the heart of the computer lies the central processing unit (CPU).
The computer keeps data and programs in storage. There are two kinds of storage.
Primary storage, also called random-access memory (RAM) or simply memory, is fast
but expensive; it is made from memory chips (see Figure 2). Primary storage has two
disadvantages. It is comparatively expensive, and it loses all its data when the power is
turned off. Secondary storage, usually a hard disk (see Figure 3), provides less
Data and programs are stored in primary storage (memory) and secondary storage
(such as a hard disk).
Some computers are self-contained units, whereas others are interconnected through
networks. Home computers are usually intermittently connected to the Internet via a
dialup or broadband connection. The computers in your computer lab are probably
permanently connected to a local area network. Through the network cabling, the 4
computer can read programs from central storage locations or send data to other 5
computers. For the user of a networked computer, it may not even be obvious which
data reside on the computer itself and which are transmitted through the network.
Figure 2
Most computers have removable storage devices that can access data or programs on
media such as floppy disks, tapes, or compact discs (CDs).
Chapter 1 Introduction Page 5 of 43
Java Concepts, 5th Edition
Figure 3
A Hard Disk.
5
A Motherboard
To interact with a human user, a computer requires other peripheral devices. The
computer transmits information to the user through a display screen, loudspeakers, and
printers. The user can enter information and directions to the computer by using a
keyboard or a pointing device such as a mouse.
The CPU, the RAM, and the electronics controlling the hard disk and other devices are
interconnected through a set of electrical lines called a bus. Data travel along the bus
from the system memory and peripheral devices to the CPU and back. Figure 4 shows
a motherboard, which contains the CPU, the RAM, and connectors to peripheral
devices.
The CPU reads machine instructions from memory. The instructions direct it to
communicate with memory, secondary storage, and peripheral devices.
6
7
Figure 5
SELF CHECK
4. Where is a program stored when it is not currently running?
Work on the ENIAC was supported by the U.S. Navy, which was interested in
computations of ballistic tables that would give the trajectory of a projectile,
depending on the wind resistance, initial velocity, and atmospheric conditions. To 7
compute the trajectories, one must find the numerical solutions of certain 8
differential equations; hence the name “numerical integrator”. Before machines like
ENIAC were developed, humans did this kind of work, and until the 1950s the
word “computer” referred to these people. The ENIAC was later used for peaceful
purposes, such as the tabulation of U.S. census data.
The ENIAC
Generally, machine code depends on the CPU type. However, the instruction set of
the Java virtual machine (JVM) can be executed on many CPUs.
8
9
A typical sequence of machine instructions is
3. If the first value is greater than the second value, continue with the instruction
that is stored in memory location 240.
Actually, machine instructions are encoded as numbers so that they can be stored in
memory. On the Java virtual machine, this sequence of instruction is encoded as the
sequence of numbers
21 40
16 100
163 240
When the virtual machine fetches this sequence of numbers, it decodes them and
executes the associated sequence of commands.
How can you communicate the command sequence to the computer? The most direct
method is to place the actual numbers into the computer memory. This is, in fact, how
High-level languages allow you to describe tasks at a higher conceptual level than
machine code.
For example, in Java, the high-level programming language that you will use in this
book, you might give the following instruction:
if (intRate > 100)
System.out.println("Interest rate error");
This means, “If the interest rate is over 100, display an error message”. It is then the
job of the compiler program to look at the sequence of characters if (intRate >
100) and translate that into
21 40 16 100 163 240 . . .
Compilers are quite sophisticated programs. They translate logical statements, such as
the if statement, into sequences of computations, tests, and jumps. They assign
memory locations for variables—items of information identified by symbolic names—
like intRate. In this course, we will generally take the existence of a compiler for
granted. If you decide to become a professional computer scientist, you may well learn
more about compiler-writing techniques later in your studies.
SECTION 3.
MEXICO.
SECTION 4.
WEST INDIES.
PUERTO RICO.
BAHAMA ISLANDS.
Lady Edith Blake, wife of Sir Henry Arthur Blake, formerly governor
of the Bahama islands, has kindly furnished the following information
and sketches (Figs. 100, 101, and 102), relating to petroglyphs in
the Bahama islands. Lady Blake says:
The carvings are on the walls of an “Indian hole,” also
called Hartford cave, in the northern shore of a small
island in Rum Cay, one of the Bahama group. Rum Cay
measures 5 miles from north to south and about 8 or 9
from east to west. It lies 20 miles northwest of Watlings
island, the San Salvador of Columbus.
The cave is situated on the seashore about a mile and a
half from the western point of the island to the eastward
of a bluff, close to which is a “puffing hole,” through which
the waves blow when the seas roll in from the north. The
cave is semicircular in shape and about 20 yards in depth,
and is partially filled with debris of rocks, earth, and sand.
Fig. 100.—Petroglyphs in the Bahamas.
GUADELOUPE.
ARUBA.
SECTION I.
PETROGLYPHS IN CENTRAL AMERICA.
NICARAGUA.
The following extract is taken from the work of Dr. S. Habel (a):
Santa Lucia is a village in the Republic of Guatemala, in
the Department of Esquintla, near the base of the Volcano
del Fuego, at the commencement of the inclined plane
which extends from the mountain range to the coast of
the Pacific Ocean. * * *
The sculptured slabs are in the vicinity of the village. The
greater number of them form an extended heap,
rendering it probable that there are others hidden from
view that more extended researches would reveal. * * *
All the sculptures, with the exception of three statues, are
in low relief, nearly all being in cavo-relievo, that is,
surrounded by a raised border, the height of which
indicates the elevation of the relief. The same kind of relief
was practiced by the ancient Assyrians and Egyptians.
In seven instances the sculpture represents a person
adoring a deity of a different theological conception in
each case. One of these seems to represent the sun,
another the moon, while in the remaining five it is
impossible to define their character. All these deities are
represented by a human figure, of which only the head,
arms, and breast are correctly portrayed, proving that the
religious conceptions had risen to anthropomorphism,
while the idols of the nations of Central America and
Mexico, which have previously come to our knowledge,
are represented by disfigured human forms or grotesque
images.
Four of the other sculptures represent allegorical subjects;
two of them the myth of the griffin, the bird of the sun.
The slabs on which the low reliefs are sculptured are of
various sizes; the greater number of these, like those
representing the deities, are 12 feet in length, 3 feet in
width, and 2 feet in thickness. Nine feet of the upper part
of these stones are occupied by the sculptures, while the
lower 3 feet appear to have served as a base.
Several illustrations of these rock sculptures are presented, infra, as
Figs. 1235 and 1236. It is evident that these very large slabs
received their markings when they were in the locality in which they
are now found so can be classed geographically.
SECTION 2.
SOUTH AMERICA.
GUIANA.
The name of Guiana has been applied to the territory between the
rivers Amazon, Orinoco, Negro, and Cassiquiare. It was once divided
into the French, British, Dutch, Portuguese, and Spanish Guianas.
The Portuguese Guiana now belongs to Brazil and Spanish Guiana is
part of Venezuela. Many petroglyphs have been found in the several
Guianas. They appear throughout the whole of the part belonging to
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookultra.com