Chapter 2
In this chapter we talk about the history of Java and describe objects and classes involved in a
restaurant. One good activity is to have the students role-play the people in a restaurant. You
can ask for students to play the greeter, customer, waiter, and chef. Tell them the task is to get
the customer fed and then tell them to go. Point out what they are doing and what data they need
to keep track of. For example, a greeter has a chart of all the tables in a restaurant, a waiter
knows the tables she is waiting on and the orders for the customers, a chef knows what food is
available and how to prepare it. Point out other objects like order, bill, and food. Point out that
there can be many objects of the same type, like 6 waiters, 3 chefs, and hundreds of customers.
In section 2.2 we introduce DrJava. You don’t have to use DrJava to use this book. However,
DrJava is free and has an interactions pane which allows students to type in Java statements and
executes them without having to create a class and a main. This is the main reason we use
DrJava. Many Java books start out with the students typing all Java code in the main method
But, even if you use another development environment consider using DrJava in class to show
your students what happens when you type things in the interactions pane. Students both enjoy
seeing things done live and enjoy when the teacher makes a mistake. Students learn from our
mistakes, so don’t be afraid to make some. Make sure that your students copy the bookClasses
directory from the CD to a directory they can modify and add the path to that directory to the
classpath in your development environment. Instructions for how to do this in DrJava are in