September 4th, 2002 04:32 PM
It would probably be helpful if you started out describing some of the basic features and terminology of java before jumping right into a program. The program might not be that hard to jump into if you are familiar with c++ and objects, but it is the kind of thing that if you haven't seen before, this could kind of blow people's minds.
I would suggest starting off describing the object oriented model. Descriping how it can take on characteristics of a real object and how objects can interact. One of the best ways I have seen this described is to right a sentence about something you want your program to do, the nouns can be your objects, the verbs/adverbs your methods. Once you get that out, I would recommend, then discussing how java is entirely object oriented, how everything in java is an object and that there are several 'sub-objects' that inherit properties of lower level objects and then expand upon them (and then in turn are inherited). This would go a long way to explaining why there is a system object and why it is used for outputing, why you are using string objects, etc.
Once you have all that down, then I would jump into a sample program like you did and demonstrate how the objects interact. Once you have down the fundamental idea of java being object oriented and basically centered around object interaction, the rest is basically learning syntax (which is very very similar to c++)...
Damn, couple of corrections, expanding of what I was saying (I tried to get this out too quick). 'described is to right' --> 'described is to write'
Also when I was discussing object interactions and inheriting object properties, and how there can be multiple levels of object property inheritance and how this leads to things in your code like System.out.println, where you are accessing the println method in the out object in the system object (or something to that effect, sorry been a few years since I used java). The other thing that I was getting at in the discussion of everything being object oriented that I left off is that java ITSELF is entirely object oriented, that every operator and data type and method is defined within various objects (ie., system.out.println) and that is why it is so critical to fully understand object oriented programming to properly understand java...
There is only one constant, one universal, it is the only real truth: causality. Action. Reaction. Cause and effect...There is no escape from it, we are forever slaves to it. Our only hope, our only peace is to understand it, to understand the 'why'. 'Why' is what separates us from them, you from me. 'Why' is the only real social power, without it you are powerless.
(Merovingian - Matrix Reloaded)