Java Reference
In-Depth Information
19 Java Never Ends
And thick and fast they came at last,
And more, and more, and more—
LEWIS CARROLL, Through the Looking-Glass
Introduction
Of course there is only a finite amount of Java, but when you consider all the standard
libraries and other accompanying software, the amount of power and the amount to
learn seem to be endless. In this chapter, we give you a brief introduction to five topics
to give you a flavor of some of the directions you can take in extending your
knowledge of Java. The five topics are multithreading, networking with stream sockets,
JavaBeans, the interaction of Java with database systems, and Web programming with
Java Server Pages.
Prerequisites
You really should cover most of the topic before covering this chapter. However,
Section 19.1 requires only Chapters 17 and 18 and their prerequisites. Section 19.2
requires Chapters 1 through 5 , 9 , and 10 . Sections 19.3 and 19.4 require only
Chapters 1 through 6 . Section 19.5 requires an understanding of HTML , which
is given in Chapter 20. Chapter 20 is distributed as a file on the website included
in this topic. Aside from references to Section 19.1 in Section 19.2, all sections are
independent of each other and may be read in any order.
19.1
Multithreading
“Can you do two things at once?”
“I have trouble doing one thing at once.”
Part of a job interview
thread
A thread is a separate computation process. In Java, you can have programs with
multiple threads. You can think of the threads as computations that execute in
parallel. On a computer with enough processors, the threads might indeed execute
in parallel. However, in most normal computing situations, the threads do not really
do this. Instead, the computer switches resources between threads so that each thread
in turn does a little bit of computing. To the user, this looks like the processes are
executing in parallel.
You have already experienced threads. Modern operating systems allow you to run
more than one program at the same time. For example, rather than waiting for your virus
 
 
Search WWH ::




Custom Search