Next: Michaelmas Term 1998: Part
Up: Long Vacation 1998: Part
Previous: Long Vacation 1998: Part
Lecturers: Dr F.H. King and Mr R.J. Stibbs
(fhk1@cl.cam.ac.uk
and
rjs1@cam.ac.uk)
No. of lectures + practicals: 20 + 3
This is a mandatory course and is a prerequisite for Further Java.
This course is normally held in the last two weeks of July. In
addition to the work specified for the formal practical classes,
numerous exercises are set. These are undertaken outside class hours
and discussed in later lectures. At the end of the course, the first
of the examinable Assessed Exercises is discussed.
Note that Java runs under Unix and the local version is the Thor
Teaching Service. 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.
- Introduction.
- A practical introduction to programming in Java using Unix
and X-windows. Unix commands. X-windows.
- Files and directories.
- The Unix file 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.
- Java types.
- Number bases, type int, variables, constants, operators,
and expressions. Types long and float. Strong typing.
The switch statement.
- Further Java types.
- Types double and boolean.
Introduction to objects: instantiation, classes as types, use of this. Rudiments of HTML.
- More about objects.
- Constructors and constructor arguments,
alternative use of this, overloading. Encapsulation: the
visibility modifiers public and private. The static
modifier. Class variables versus instance variables. Type
String, the toString method. Formatted output.
- Sorting, more on method arguments.
- Type char. Method overloading. Introduction to sorting.
Call by value versus call by reference.
- Recursion, inheritance.
- Rounding errors. Introduction to recursion. Class hierarchy:
inheritance and method overriding.
- Abstract classes.
- Generic types, abstract classes. Case study: the Power
Problem, an O(log n) algorithm.
- Packages, applets.
- Java packages: the package statement and the import
statement. Introduction to applets; the appletviewer
command.
- Interfaces.
- The instanceof keyword. Java interfaces. Operations on bits.
Case study: the Eight-Queens problem.
- Exception handling.
- Exceptions: declaring exceptions, try-catch-finally.
Lists in Java.
- Input.
- The Java DataInputStream. Case study: extracting integers
from unformatted data.
- Threads.
- Introduction to threads. More about applets: use of type StringBuffer.
The finalize method.
- More about threads and applets.
- The synchronized keyword. More about applets: using the mouse.
Case study: the Triangular Solitaire problem.
- Thread case studies.
- A simple buffer. The Dining Philosophers problem.
- Trees and lattices.
- Tree representation of an arithmetic expression. A card-shuffling
algorithm. Trees and lattices.
- Classes within classes.
- Ordinary top-level classes. Nested top-level classes. Member classes.
Local classes. Anonymous inner-classes. Hashing.
- An expression parser.
- Concluding case studies: handling large integers, lexical analysis and
syntax analysis of an arithmetic expression.
Recommended books:
Flanagan, F. (1997). Java in a Nutshell. O'Reilly.
Eckel, B. (1998). Thinking in Java. Prentice-Hall.
Next: Michaelmas Term 1998: Part
Up: Long Vacation 1998: Part
Previous: Long Vacation 1998: Part
Christine Northeast
1998-10-01