free ebooks
 Home Computers & InternetProgramming > Java  
Java Au Naturel

This chapter presents an overview of object-oriented programming in Java. Sections 1.1
through 1.4 show you how to control an object that can draw pictures. This object is
called a turtle because it is based on the Logo programming language, in which a turtle
icon does the drawing.
You will learn to create turtle objects and to send them messages to take actions. A
turtle understands only eight elementary kinds of messages, but Java lets you teach the
turtle new messages that are combinations of existing ones. You supply the artistic ability
by deciding which messages to send in what order; the turtle carries out your requests.
The real purpose of the first part of this chapter, however, is to give you the opportunity to
write programs that will impress your friends and relatives. Naturally, you cannot expect
to be able to create an interesting program from scratch until you have been studying
computer science for several weeks. But you can download the three-page turtle
software from this book's website or type it in from the listings in Chapter Eight. Then,
with the help of these turtle objects, you can create a program that draws complex
pictures. When your friends and relatives ask you what you have learned to do in the
course, you will have something good to show them by the end of your first week.
In this context, you will learn to define executable Java programs and to define instance
methods without parameters or return values. Section 1.5 explains in detail how to
compile and execute your programs in the terminal window.
Later sections give examples of programs using other kinds of objects. One is a program
that sends messages to portfolio objects to perform financial-market tasks. Another is a
program that sends messages to other kinds of objects to perform personnel database
tasks. We even include a very simple program developed in Java from scratch, using
only facilities that come with every Java compiler. This foretaste requires showing you
language features whose full explanation is in Chapters Two through Four, so you are not
responsible for remembering these features at this point.

Read More

 Additional Info
 No. 255
 Posted on 8 June, 2006
Bookmark This Page
Facebook MySpace Twitter Digg stumbleupon friendfeed Delicious


Link to us from your website or blog by using the code below in your html
@2008 ebooklobby privacy policy email: info [at]