Chapter 2

Programming in the Small
Variables, Input/Output, Control Statements


ON A BASIC LEVEL (the level of machine language), a computer can perform only very simple operations. A computer performs complex tasks by stringing together large numbers of such operations. Such tasks must be "scripted" in complete and perfect detail by programs. Creating complex programs will never be really easy, but the difficulty can be handled to some extent by giving the program a clear overall structure. The design of the overall structure of a program is what I call "programming in the large."

Programming in the small, which is sometimes called coding, would then refer to filling in the details of that design. The details are the explicit, step-by-step instructions for performing fairly small-scale tasks. When you do coding, you are working fairly "close to the machine," with some of the same concepts that you might use in machine language: memory locations, arithmetic operations, loops and decisions. In a high-level language such as Java, you get to work with these concepts on a level several steps above machine language. However, you still have to worry about getting all the details exactly right.

This chapter examines the facilities for programming in the small in the Java programming language. Don't be misled by the term "programming in the small" into thinking that this material is easy or unimportant. This material is an essential foundation for all types of programming. If you don't understand it, you can't write programs, no matter how good you get at designing their large-scale structure.


Sections in Chapter 2:

  1. The Basic Java Application
  2. Variables and the Primitive Types
  3. Blocks, Loops, and Branches
  4. Text Input and Output
  5. Algorithm Development
  6. The Structure of Java Programs
  7. Details of Expressions
  8. Details of Statements
  9. Details of Strings

[ First Section | Next Chapter | Previous Chapter | Main Index ]