Computer Science 268: Introduction to Computer Programming (Java)

Study Guide

Unit 7

Read Chapter 7 of the textbook: Arrays and ArrayLists

This chapter revisits arrays and introduces ArrayList. The chapter also covers searching and sorting, two common and important programming operations. The chapter concludes by examining two-dimensional arrays.

Section 7.1 Array Details

This section revisits arrays, covering the for–each loop, arity methods and array literals. The discussion of each will serve to enhance your ability to use arrays in your programs.

Read and review this section carefully.

Section 7.2 Array Processing

This section provides examples of how array processing can be employed in the programs you write. It also introduces dynamic arrays.

Read and review this section carefully.

Section 7.3 ArrayList

This section introduces ArrayList, a standard Java class that provides powerful array processing capabilities.

Read and review this section carefully.

Section 7.4 Searching and Sorting

This section introduces and discusses searching and sorting in Java programs. The section includes some examples of ways you can search and sort.

Read and review this section carefully.

Section 7.5 Two-dimensional Arrays

Two-dimensional arrays are an extension of one-dimensional arrays, but they are considerably more complex because you must keep track of the second dimension. This section includes a discussion of two-dimensional arrays, programming tips for two-dimensional arrays, and a couple examples.

Note that the complete programs provided in the textbook involve GUI programming. Examine the core two-dimensional aspects of the examples, but do not worry about the GUI components.

Read and review this section carefully. GUI programming does not fall within the scope of this course.

Programming Exercises

It is a good practice to attempt the programming exercises in the textbook, to put the topics you have learned into concrete Java code. This, in turn, allows you to reflect on the material you have read. Skip any exercises relating to topics in Chapter 7 that are not covered in the course.

Resist the temptation to download the programming exercises from the textbook and simply run them. The greatest benefit in learning to program in a new language occurs when you type all the example code yourself.

Typing the code, even for simple examples, engages your brain in the process of writing code, compiling code, running code, and diagnosing and resolving problems that may arise. It is the latter skill—problem solving—that can become the most powerful tool in learning to program.

Quiz

It is a good practice to review the chapter quizzes in the textbook, as the questions allow you to reflect on the material you have read.