Computer Laboratory Home Page Search A-Z Directory Help
University of Cambridge Home Computer Laboratory
Computer Science Tripos Syllabus - Foundations of Programming in Java
Computer Laboratory > Computer Science Tripos Syllabus - Foundations of Programming in Java

Foundations of Programming in Java next up previous contents
Next: Michaelmas Term 2004: Part Up: Long Vacation 2004: Part Previous: Long Vacation 2004: Part   Contents


Foundations of Programming in Java

Lecturers: Dr F.H. King and Mr R.J. Stibbs

No. of lectures and practicals: 20 + 20


This is a mandatory course for students intending to read Computer Science Part II (General).


This course is a prerequisite for the Group Project.

This course is normally held in the last two weeks of July. Practical work (formal and informal) is associated with each lecture. Solutions to most problems are issued a few lectures after being set. At the end of the course, the first of the examinable Assessed Exercises is discussed.


The implementation of Java that is used on the course runs under a local version of Unix. Features of Unix are introduced as they are required during the course but, in the interests of readability, the information below is principally concerned with Java, and references to Unix are sparse.


Aims


The principal aim of this course is to introduce the rudiments of programming via the Java language. A secondary aim is to provide sufficient instruction in Unix to run both Java applications and Java applets using this operating system.


Lectures

  • 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. Primitive data type char. Unicode. The Java DataInputStream. Case study: extracting integers from unformatted data.

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

Objectives


At the end of the course students should

  • have some familiarity with Unix and the Emacs editor

  • be able to write simple Java applications including those which involve exception handling and threaded code

  • be able to write simple Java applets

Recommended books


*Flanagan, F. (1997). Java in a nutshell. O'Reilly.
*Eckel, B. (1998). Thinking in Java. Prentice-Hall.


next up previous contents
Next: Michaelmas Term 2004: Part Up: Long Vacation 2004: Part Previous: Long Vacation 2004: Part   Contents
Christine Northeast
Wed Sep 8 11:57:14 BST 2004