The aim of this course is to introduce the rudiments of programming
via the Java language.
Lectures
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 be able to
write simple Java applications including those
which involve exception handling and threaded code
write simple Java applets
Recommended books
* Flanagan, F. (1997). Java in a nutshell. O'Reilly.
* Eckel, B. (1998). Thinking in Java. Prentice-Hall.