4. Java Program Design and Development

4.1. Introduction

This chapter introduces some of the basic concepts and techniques in- volved in Java program design and development. We begin by identi- fying the main steps in designing an object-oriented program. The steps are illustrated by designing a program that “asks” and “answers” riddles. As an example of a riddle, consider the question “What is black and white and read all over?” The answer, of course, is a newspaper. Following the design phase, we then focus on the steps involved in coding a Java program, including the process of editing, compiling, and running a pro- gram. Because Java programs can be text based applications or window based graphical applications, we describe how the coding process differs for these two varieties.

Next we begin to familiarize ourselves with Java’s extensive class li- brary by studying its PrintStream and System classes. These classes contain objects and methods that enable us to print output from a pro- gram. By the end of the chapter you will be able to design and write a Java application that “sings” your favorite song.