Book Image

Oracle Certified Associate, Java SE 7 Programmer Study Guide

By : Richard M. Reese
Book Image

Oracle Certified Associate, Java SE 7 Programmer Study Guide

By: Richard M. Reese

Overview of this book

<p>Java SE 7 Associate Programmer certification adds to your qualification as a Java developer. Knowledge of Java is important, but knowing how to write an efficient and productive code adds to your skills and gives you an edge when you are planning to give the certification exam. Coverage of the objectives goes beyond a simple review of certification objectives.</p> <p>"Oracle Certified Associate, Java SE 7 Programmer Study Guide" addresses certification exam objectives and provides discussion and examples to show the best ways of applying Java language features in real world programming. You will gain in-depth understanding of Java by examining how objects are allocated in the heap and how methods are managed in the program stack.<br /><br />"Oracle Certified Associate, Java SE 7 Programmer Study Guide" covers all of the Java SE 7 Associate Programmer certification objectives. It starts with a high level overview of an application’s structure to provide a framework for subsequent chapters. Chapters are organized around common themes with emphasis on memory usage. You will get an in-depth and complete understanding of the run-time Java environment using the illustrations that show the impact of class and method usage on the program stack and heap. <br /><br />Augmenting the coverage of certification objectives are examples of how you can use the classes, methods, and techniques in a productive and sound manner. In addition, sample exam questions are given in each chapter.</p>
Table of Contents (16 chapters)
Oracle Certified Associate, Java SE 7 Programmer Study Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface

Chapter 4. Using Arrays and Collections

This chapter, when boiled down to its essence, is about data structures. Specifically, it is about arrays—the java.util.Arrays and java.util.ArrayList classes. An array is a region of memory that can be addressed using a single variable name. It provides an efficient technique for accessing data in a sequential or random fashion. The Arrays class provides support for arrays while the ArrayList class provides array-like behavior but is not fixed in size.

We are concerned with how to create and use these data structures. A common operation is the traversal of an array or collection. We will see that Java supports several approaches permitting us to move through the elements of an array or an ArrayList object. Common to both arrays and collections is the ability to use the for-each statement. Iterators provide an alternate approach for accessing collections such as the ArrayList, and will also be discussed.

We will start by examining arrays in detail...