1: Becoming a Java Programmer#

A way to think about programming in Java is that we have storage, called the computer’s memory or RAM, in which to place information or whatever needs to be remembered. The instructions in Java manipulate this storage to perform calculations or change the information. We can visualize programming as memory manipulation, using the few commands available in the language.

Since information is stored in memory, the computer needs to know how much room is required for each item. In Java, we explicitly specify this by stating the data type of each of our variables. In this chapter, we will learn about all the data types in Java.

When we give commands to manipulate the data, the commands are completed sequentially unless we use special commands to change that: commands to create conditions and repetition. These form the real power of computing and we will learn about the if-statement and two kinds of loops (for-each and while) in this chapter.

Finally, we will learn about making our code more readable and reuseable through the use of methods. Methods give us a way to chunk up our code, give the code a name, and use the code elsewhere, often in multiple places. You will need to know how to store information in the computer’s memory and you will need to know how to change the execution order.