Computer Laboratory

Course pages 2014–15

Programming in Java

Principal lecturers: Dr Alastair Beresford, Dr Andrew Rice
Taken by: Part IA CST, Part IA NST, Part I PBS
Past exam questions
Information for supervisors (contact lecturer for access permission)

No. of practical classes: 10 x 2-hour sessions (continued into Lent term)
Prerequisite course: Foundations of Computer Science
Companion courses: Object-Oriented Programming, Numerical Methods
This course is a prerequisite for Algorithms, for Further Java and for Concurrent and Distributed Systems, as well as for the Group Project.


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

  • 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 8 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.).