O'Reilly logo

OCA Java SE 7 Programmer Study Guide (Exam 1Z0-803) by Budi Kurniawan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5

Arrays

In Java you can use an array to group primitives or objects of the same type. The entities belonging to an array is called the elements or components of the array. In this chapter you will learn how to create, initialize and iterate over an array as well as manipulate its elements. This chapter also features the java.util.Arrays and java.util.ArrayList classes.

5.1 Array Overview

In the background, every time you create an array, the compiler creates an object which allows you to:

  • get the number of elements in the array through the length field. The length or size of an array is the number of elements in it.
  • access each element by specifying an index. This indexing is zero-based. Index 0 refers to the first element, 1 to the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required