O'Reilly logo

Java for Android, Second Edition 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 6

Arrays

In Java you can use arrays 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 class, a utility class for manipulating arrays.

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 ...

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