Computer Laboratory

Course material 2010–11

Paper 1: Programming in Java

Lecturers: Dr A.R. Beresford and Dr A.C. Rice

No. of practical classes: 8 $\times$ 2-hour sessions

Prerequisite course: Foundations of Computer Science

Companion courses: Object-Oriented Programming, Floating-Point Computation

This course is a prerequisite for Algorithms I and II, and for the Group Project and Part IB course Concurrent and Distributed Systems.


The goal of this course is to provide students with the ability to write programs in Java and apply concepts described in the Object-Oriented Programming course. The course is designed to accommodate students with diverse programming backgrounds; consequently Java is taught from first principles in a practical class setting where students can work at their own pace from a course handbook. Each practical class will culminate in an assessed exercise.

Practical classes

  • Introduction. This class will introduce the students to PWF Linux, the Java compiler and tool chain. Students will design, implement and test their first Java application.

  • Methods, operators and types. This class will concentrate on the fundamentals of imperative programming. Students will learn about Java primitive types, variable declaration, operators and method calls.

  • Control structures. Students will explore the control structures found in Java.

  • Arrays, references and classes. This week the students will explore arrays and references in Java and learn how to define and instantiate their own class.

  • Input/Output and Exceptions. This class will examine streams and Exceptions. Students will read and write data to and from the filesystem and network and learn to handle errors using Java Exceptions.

  • Inheritance and interfaces. This class will explore object-oriented programming as expressed in Java. Students will learn how to extend classes, as well as specify and provide implementations for Java interfaces.

  • Abstraction and graphical interfaces. Students will examine code-reuse through inheritance and the use of inner classes for encapsulation. Students will begin to construct a graphical interface using Swing.

  • Swing and event handling. Students will complete their graphical interface by writing event handlers to control the execution of a graphical application.


At the end of the course students should

  • be familiar with the main features of the Java language;

  • be able to write a Java program to solve a well specified problem;

  • understand a Java program written by someone else;

  • be able to debug and test Java programs;

  • be familiar with major parts of Java 6 SE libraries;

  • understand how to read Javadoc library documentation and reuse library code.

Recommended reading

* Eckel, B. (2006). Thinking in Java. Prentice Hall (4th ed.).