Java is a relatively young programming language. It was initially designed by Sun Microsystems in 1991 as a language for embedding programs into electronic consumer devices, such as microwave ovens and home security systems. However, the tremendous popularity of the Internet and the World Wide Web (WWW) led Sun to recast Java as a language for embedding programs into Web-based applications.
Java has been designed with a number of interesting features:
Despite this list of attractive features, perhaps the best reason for choosing Java as an introductory programming language is its potential for bringing fun and excitement into learning how to program. In what other language can a beginning programmer write a computer game or a graphically based application that can be distributed on a Web page to just about any computer in the world?
For example, one of the projects we will work on throughout the text is the CyberPet program. CyberPet starts out as a very simple simulation of a pet that responds to commands like ``eat'' and ``sleep.'' As we learn more sophisticated programming techniques we gradually build more complexity into the simulation. For example, we learn how to add graphical images to the program in Chapter 4. In Chapter 6 we learn how to animate the CyberPet's eating behavior. In Chapter 8 we add randomness to the CyberPet's behavior so that it disobeys our commands from time to time. Finally in Chapter 15 we learn how to introduce multiple CyberPets of different kinds that behave in a completely autonomous fashion.
<a href="http://troy.trincoll.edu/ cpsc115/pet/">Click here to play with CyberPet.</a>