Computer Laboratory

Course pages 2012–13

Object-Oriented Programming


The notes as printed

Annotated Slides

The FULLY ANNOTATED slides from lectures

Examples Sheet

The examples sheet. Please consult your supervisor for an appropriate subset of these questions to do.

Code, Clarifications and Useful Links

Lecture 3 Detailed explanation of the reference passing example at the start of this lecture
Lecture 4 Bouncing Ball example
Shape drawing example
Lecture 5 Tradesman interface code
Java 7 API
Lecture 7 Cloning code
Lecture 8 Java 7 API
Detailed Collections tutorial (without generics)
Detailed Generics tutorial (with generics)
Type erasue example (compile with javac and then decompile with javap -c class-file
Lecture 9 (for loops, iterators, etc) (basic use of Set and Map)
Comparison examples
Lecture 10 Decorator pattern code
State pattern code
Strategy pattern code
Composite pattern code
Lecture 11 Decorator pattern code
Proxy pattern code
Observer pattern code
Breakout game


Quite a few changes to the slides and examples sheet occured this year and inevitably there are errors in both. The annotated lecture notes above show those I spotted in lecture. Please let me know if you spot any others (

Page 19 In the paragraph that starts "We speak of an...", the subsequent example (for which all of the example phrases applies) whould say "B extends A and not vice-versa.
Page 20 The "Narrowing Conversions" has a mistake in the bottom right example. The second line should say "Person p = (Person)s";

Sample Tripos Questions

I have started to produce a few sample exam questions for the course since it's a recent addition to the IA CST lineup.