1.5 An Introduction to Programming

1.5.1 Programming Basics

In many ways, programming is like solving a puzzle. We have a task to perform and we know the operations that a computer can perform (input, calculations, comparisons, rearranging of items, and output). As programmers, our job is to decompose a task into individual, ordered steps of inputting, calculating, comparing, rearranging, and outputting.

For example, suppose our task is to find the sum of two numbers. First, our program needs to read (input) the numbers into the computer. Next, our program needs to add the two numbers together (calculate). Finally, our program needs to write (output) the sum.

Notice that this program consists of steps, called instructions, which are performed ...

Get Java Illuminated, 5th 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.