Computer Laboratory > Teaching > Course material 2008–09 > Long Vacation Java course


Long Vacation Java course

Principal lecturer: Dr Frank King
Taken by: long vacation term students

Students and staff of Cambridge University may attend the July run of this course (13 to 24 July 2009), but must book a place, sending an e-mail to chn2 @ cam . ac . uk between 1 May 2009 and the start of the course.

There is a provisional timetable.

Course notes etc


The course is likely to include the following:

  • Introduction. A practical introduction to programming in Java using Unix and X-windows. Unix commands. X-windows.
  • Files and directories. The Unix filing system and associated commands.
  • Elements of programming in Java. Imperative programming. Compiling and running simple Java programs. The Java Virtual Machine. Java classes, data fields and methods. Method arguments and local variables.
  • Some Java constructs. Loops, conditions and relational operators. Reserved words. Arrays.
  • Types, classes and objects. Types and strong typing. Variables, constants, operators, and expressions. Primitive data types int and float. Reference data types. Introducing objects: instantiation, this, constructors. Visibility modifiers, encapsulation. The toString() method. The static modifier. Instance variables versus class variables, instance methods versus class methods.
  • Further Java types, more about objects. Primitive data types double and boolean. Objects continued: class hierarchy, inheritance, overriding, super(), overloading.
  • Yet more Java types, HTML. Number bases. Primitive data types long, short and byte. Reference data type String. Formatted output. Call by value versus call by reference. The switch statement. Rudiments of HTML.
  • Sorting, abstract classes. Introduction to sorting. Rounding errors. Generic types, abstract classes. Case study: abstract class Shape.
  • Packages, recursion. Java packages: the package statement and the import statement. $CLASSPATH. Introduction to recursion. Case study: the Tower of Hanoi.
  • Multiple inheritance, interfaces. Multiple inheritance via interfaces. The instanceof operator. Case study: abstract class Shape continued. Mid-course exercise: the Power Problem, an O(log n) algorithm.
  • Applets, bit-level programming. Introduction to applets: the appletviewer command. The Abstract Windowing Toolkit. Wrapper classes. Operations on bits. Case study: the Eight Queens Problem.
  • Exception handling. Exceptions: declaring exceptions, throwing and catching exceptions, try-catch-finally. Lists in Java.
  • Input, enum. Primitive data type char. Unicode. The Java InputStreamReader. Use of enum classes. Case studies: extracting integers from unformatted data and an enum illustration.
  • Stylistic considerations. Use and misuse of object oriented programming. Helper classes. Case study: abstract class Shape improved. Eight-Queens-like problems. Case study: the Croquet Fixtures Problem.
  • Applets, GUIs, threads. More on applets: adding an ActionListener, implementing an ActionEvent. Member classes. Case study: a simple Graphical User Interface. Introduction to threaded code. The finalize() method.
  • More about threads. The synchronized keyword, monitors. Case study: the Triangular Solitaire Problem.
  • Applets, Thread case studies. Adding a MouseListener, the MouseAdapter class. A simple buffer. Blocked on synchronized and blocked on wait(). Case study: the Dining Philosophers Problem.
  • Class Shape concluded, trees and lattices. Extending the inheritance hierarchy. Case study: abstract class Shape concluded. Tree representation of an arithmetic expression. Tree searches versus lattice searches.
  • Classes within classes. Ordinary top-level classes. Nested top-level classes. Member classes. Local classes. Anonymous inner-classes.
  • An expression parser. Hashing. The lexical analysis and syntax analysis of an arithmetic expression.