context

- zio Dialog -

author

What students want these days is a GUI or even a multimedia approach. In order to give them part of what they want and to emphasize object-oriented programming at the same time, I have placed two classes DialogWindow and DisplayWindow in the zio package.

Here is a sequence of nine examples of Java source code I intend to use to introduce Java using the zio package and emphasizing objects early on. Each example consists of some source code. Many of them contain exercises in comments. The sequence is fast paced. You may have to introduce extra examples for your own class. One way to do that is to show cut down versions of some of these examples first.

  1. HellowOrld. A simple program of the “Hello World” type.

  2. HellowOrld2. Introduces variables.

  3. ShowFile. Introduces whole file I/O by simplying displaying an entire file.

  4. ShowFile2. Introduces string concatenation.

  5. Saturn. Introduces reading images with InOut.readImage and displaying them with DisplayWindow.

  6. ThreeImages. Introduces a way to define your own method.

  7. EchoDialog. Introduces redefining a method with inheritance. The method is a user input processing method in DialogWindow.

  8. DynamicImage. Introduces the if statement. Uses a DialogWindow to control the creation and recreation of a DisplayWindow.

  9. DynamicImage2. Introduces else, &&, and ||.

By the end of this sequence of examples, it is possible to have serious programing exercises that make use of branching, Strings, inheritance (limited to DialogWindow), and method building.

From here I think you could take almost any text and build meaningful examples out out of its material, regardless of the order that material is presented in. I intend to continue with similar examples through Strings, single-dimensional arrays, primitive types, loops, recursion, scope, lifetime, reference semantics, interfaces, and higher-dimensional arrays in approximately that order.

Source code for all these examples, some related data files, and a jar file containing the zio package are bundled together in one zip file. You will need version 1.4 or later of the development system.

contextJul 12, 2005author