Code for these classes can be found in the directory
/import/teaching/BSc/1st/ItP/BarnesThis directory contains one sub-directory for each chapter of the book. These sub-directories hold the
.java
files for the
various examples and exercises in each chapter. For instance, the directory
Common
contains the file Nothing.java
, which is
referred to in Chapter 2: Common Program Components.
In some cases, additional sub-directories have been created beneath
the individual chapter directories. For instance, for Chapter 3, the
directory Creating
contains sub-directories Bank
and Ships
. These collect related groups of examples and
exercises.
In order to run many of these examples, additional .class
files are required. These supply, for instance, GUI functionality. The
corresponding .java
sources of these classes may be found in
src
sub-directories, such as the Creating/Bank/src
and Creating/Ships/src
. These sources typically contain more
complex features of Java than will have been covered at that stage of the
book.
So, to run examples from the book, copy all the files ending in
.java
and .class
from the appropriate
subdirectory listed below (in some cases from a subdirectory listed
within one of those below) into a subdirectory of your own. Then just
compile the program using javac
. You need not worry about
what the Java code that produced the .class
files you copied
is like, though it will generally use advanced aspects of Java. But if
you are interested, you can take a look at it in the src
subdirectory. Code for several of the GUI classes used is also found in
the utilities
directory.
The utilities directory contains packaged versions of several of
these GUI classes, and javadoc documentation on them. The .class
files for this package are stored in utilities.jar
.
Applets
- Chapter 20: Applets
Arrays
- Chapter 9: Arrays and Further Statements
AWT
- Chapter 16: AWT Applications
Bits
- Chapter 1: Bits, Bytes, and Java
Collections
- Chapter 10: Collection Classes
Common
- Chapter 2: Common Program Components
Creating
- Chapter 3: Creating and Using Objects
Defining
- Chapter 4: Defining Classes
Exceptions
- Chapter 11: Exceptions
IO
- Chapter 12: Input-Output
Inheritance
- Chapter 14: Class Inheritance
Interfaces
- Chapter 13: Interfaces
Nested
- Chapter 15: Abstract and Nested Classes
Networks
- Chapter 19: Networking
Packages
- Chapter 8: Packages and Utility Classes
Repetition
- Chapter 7: Adding Repetitive Behavior
Selection
- Chapter 6: Adding Selective Behavior
Sequence
- Chapter 5: Adding Sequential Behavior
Simulation
- Chapter 21: Simulation
Swing
- Chapter 17: Swing
Threads
- Chapter 18: Threads
utilities
- utility classes, such as SimpleInput
Chapter 3: Creating and using objects
Chapter 6: Adding Selective Behaviour and Chapter 7: Adding Repetitive Behaviour
Utilities