Chapter 2. Simple programs

Simple programs

2.1 Three starter programs

2.2 The structure of a program

2.3 Basics of object orientation

2.4 Beginning with output

2.5 Simple calculations

In this chapter we give a broad overview of the different parts of a Java program and how they fit together. Using three carefully chosen examples, we are able to explain the concepts of object-oriented programming so that, by the end, we shall be able to create and run simple programs that have tangible results. The programs are written in the best Java style, and form the pattern for solutions to follow.

Three starter programs

To start this chapter we shall look at three small programs ...

Get Java Gently, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.