Chapter Two – Variables and Operators


Chapter two introduces you to statements, variables, state diagrams, and explores different error types. In this chapter the authors only present a single complete program. So to duplicate the code examples, you will use DrJava Interactions Pane. If you haven’t read and worked through Appendix A, Development Tools, it would probably prove beneficial to read and work through it before attempting chapter two.

You use DrJava in this chapter, so here is an introductory video if you need help installing and running.

Chapter Slides
Try It – Step by Step
Supplementary Videos

Udacity and LearningLad both present some excellent videos on the topics in chapter two. Watch the Udacity videos for more explanation and LearningLad’s videos for more hands-on practice.


The following playlist is the complete lesson on variables presented by Udacity. It is an excellent introduction to variables.


The following videos by LearningLad provide excellent tutorials on the same topics presented in this chapter.

  • Variables and Datatypes
  • Creating and Using Variables
  • Arithmetic Operators
  • Increment and Decrement Operators