Arrays
Objectives
Applied
- Given a list of values or objects, write code that creates a one-dimensional array that stores those values or objects.
- Use for loops and enhanced for loops to work with the values or objects in an array.
- Use the methods of the Arrays class to fill an array, compare two arrays, sort an array, or search an array for a value.
- Implement the Comparable interface in any class you create.
- Create a reference to an array and copy elements from one array to another.
- Given a table of values or objects, write code that creates a two-dimensional array that stores those values or objects. The array can be either rectangular or jagged.
- Use for loops and enhanced for loops to work with the values or objects in a two-dimensional array.
- Given the Java code for an application that uses any of the language elements presented in this chapter, explain what each statement in the application does.
Knowledge
- In general, explain what an array is and how you work with it.
- Describe the operation of the enhanced for loop and explain why it's especially useful with arrays.
- Explain when you need to implement the Comparable interface in a class you create.
- Explain what happens when you assign a new array to an existing array variable.
- Describe the difference between a rectangular array and a jagged array, and explain the difference in how you create them.