Introduction to Programming: Additional work for week 8

Once we have covered defining our own objects through classes, we have reached the heart of Java. In fact Java text books often cover simple classes defining objects before the basic code structuring mechanisms of loops and selection statements are covered. This approach is taken in both the Barnes and Horstmann textbooks which cover classes which define objects in chapters 4 and 3 respectively.

Although exceptions and try-catch statements are sometimes treated as "advanced" aspects of Java and discussion of them is delayed until after other matters in presenting the language, in practice it is difficult to get far in Java without encountering them, and realistic Java programs make common use of them. Reflecting this, some authors (Horstmann and Bishop in the recommended textbooks for this course) introduce exceptions early on, and I have followed this.

You should read up on basic object definition through writing your own classes, and on exceptions in your text book.

Local notes which include a section on exceptions can be found here. Notes available over the web on exceptions include those from:

Defining objects with classes is fundamental to Java, but there's a lot of new concepts to pick up, even for those who have programmed before in a language which is not object-oriented. In fact, some experts suggest it's harder to learn to program in an object-oriented way if you have programmed before in another way than it is to learn to program in that way from never having done any programming before. Introductory material introducing the basic concepts of OOP in Java includes:

Matthew Huntbach
15th November 2000