Preface - Hands On Java


There is an old Chinese proverb that reads:

   I hear and I forget,
   I see and I remember,
   I do and I understand.

The proverb points out that human learning (or understanding) is best accomplished as an active, hands-on process involving a variety of our senses. In recognition of this, computing has increasingly become a laboratory discipline, in which dry, abstract lectures are being replaced by hands-on laboratory experiences. By doing so, the passive listeners of a lecture are replaced by active participants in a laboratory experiment. Learning occurs by doing.

This book provides a set of exercises for a laboratory course in which students are introduced to computer programming using the language Java. Unlike most books on Java, no previous programming experience is assumed.

Thanks to the ability to hyperlink materials, the material common to each platform will be presented with links to the portions that are specialized for the individual platforms. Specialized material has been provided for:


This manual uses the introduce, use, build 'spiral' approach. Topics like methods, control structures and classes are introduced early, used until they become familiar, and then built. Within this framework, the central ideas of object-oriented programming are introduced gradually, as appropriate to the problems being solved. By the end of the manual, the focus is almost solely on classes and object-oriented techniques.

There are two kinds of exercises provided in this manual. There are thirteen text based exercises that relate to the material from a single chapter in Java: An Introduction to Computing. There are five additional GUI interludes that typically correspond to material from more than chapter. The text based exercises can be done separately from the GUI interludes. Each of the text based exercise consists of three parts:

  1. A pre-lab question list. Each laboratory exercise introduces new topics and concepts. If a student arrives at a closed lab session unfamiliar with the day's material, then s/he will waste a significant amount of time becoming familiar with that material. To prevent this from occurring, the first link on each exercise consists of a page of five simple questions, whose answers appear in the lab exercise. By requiring their students to answer (and turn in) these questions in order to be admitted to a lab session, instructors can ensure that students have read the exercise beforehand. This in turn will ensure that the students' lab time is spent using the machines, rather then reading.
  2. The laboratory exercise. This portion of the exercise is to be done in a closed lab, with an instructor and/or TA available for help if you become stuck.
  3. Programming projects. Four programming projects (of varying difficulty levels) are provided with each lab. An instructor can assign a project of the appropriate difficulty level to be completed outside of the closed laboratory session. A project grade sheet is provided with suggested point values, to simplify project evaluation.

The laboratory exercises can be done individually or collaboratively (though each student should get hands-on experience). The pre-lab exercises and projects are intended to be done individually.

For the GUI interludes projects are not included and are left to the discretion of the instructor. One reasonable possibility is to ask the students to implement GUI for the projects associated with the text based exercises.

Pedagogical Issues

In keeping with recommendations made at the 1994 SIGCSE workshop on Implementing Closed Labs, the exercises incorporate a number of pedagogical features. These include:

We would be remiss if we neglected to mention that Java is a huge language. Aside from the basic language itself, Java has a large number of classes defined in its class libraries (get the documentation from Sun). The exercises in this book are intended to introduce novice programmers to Java, not explore the language exhaustively. By the time a student completes the exercises in this book, s/he should be capable of reading and understanding any of the many books that provide comprehensive coverage of the Java language. More advanced topics are left for the student to explore once they have firmly grasped the fundamentals.

Code Distribution

The Java files for these exercises are provided as a "built-in" part of each exercise, accessed via a hyperlink. There is thus no need to ftp or uncompress these files.

All the files are located in the folder IncludedCode.

If you are working in a networked environment, you may wish to review the lab exercise ahead of time, and download any source files it uses for your students to local storage.

There is some documentation of the packages included with this manual.


This work is based on the earlier lab manual Hands on C++ by Joel Adams and borrows a significant amount of material from it.


Because everyone is human, feedback is encouraged on those exercises (or parts of exercises) that are particularly effective, and those that need modification. Positive and negative comments can be directed to Joel Adams at the following U.S. mail address:

   Joel Adams
Department of Computer Science Calvin College Grand Rapids, MI 49546


or to via e-mail.


Back to the Main Table of Contents

Copyright 2000 by Prentice Hall. All rights reserved.