AP® Computer Science A glossary

Element

Course: AP® Computer Science A Shows up in: Unit 4: Data Collections

One value stored in an array or an ArrayList, at a position given by its index.

Appears in the course and exam description (CED): 4.3.A.14.3.A.34.3.A.5

In an array, arr[i] reads or changes the element at index i; in an ArrayList, use get(i) and set(i, value). Elements of a new array start with the default value for their type.

String[] seats = new String[2];
seats[0] = "Ana";
System.out.println(seats[0] + " " + seats[1]);

Output:

Ana null
Learn it properly, with a checkpoint 4.3 Array Creation and Access

Related terms

Was this page helpful?

No names are ever shown, and every public comment is checked by us first. Please do not include personal details. To get a reply, email [email protected].

↑ Top

Enlarged view of the selected figure