Deck 7: Arrays and Arraylists
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/46
Play
Full screen (f)
Deck 7: Arrays and Arraylists
1
A programmer must do the following before using an array:
A) declare then reference the array.
B) create then declare the array.
C) create then reference the array.
D) declare then create the array.
A) declare then reference the array.
B) create then declare the array.
C) create then reference the array.
D) declare then create the array.
declare then create the array.
2
An exception object's ________ method returns the exception's error message.
A) String
B) Message
C) Error
D) toString
A) String
B) Message
C) Error
D) toString
toString
3
Which of the following statements is false?
A) An exception indicates a problem that occurs while a program executes.
B) Exception handling enables you to create fault-tolerant programs that can resolve (or handle) exceptions-in many cases, this allows a program to continue executing as if no problems were encountered.
C) The catch block contains the code that might throw an exception, and the try block contains the code that handles the exception if one occurs.
D) Inside the catch block, you can use the parameter's identifier to interact with a caught exception object.
A) An exception indicates a problem that occurs while a program executes.
B) Exception handling enables you to create fault-tolerant programs that can resolve (or handle) exceptions-in many cases, this allows a program to continue executing as if no problems were encountered.
C) The catch block contains the code that might throw an exception, and the try block contains the code that handles the exception if one occurs.
D) Inside the catch block, you can use the parameter's identifier to interact with a caught exception object.
C
4
Consider the array:
s[0] = 7
S[1] = 0
S[2] = -12
S[3] = 9
S[4] = 10
S[5] = 3
S[6] = 6
The value of s[s[6] - s[5]] is:
A) 0.
B) 3.
C) 9.
D) 10.
s[0] = 7
S[1] = 0
S[2] = -12
S[3] = 9
S[4] = 10
S[5] = 3
S[6] = 6
The value of s[s[6] - s[5]] is:
A) 0.
B) 3.
C) 9.
D) 10.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
5
Invalid possibilities for array indices include .
A) Positive integers.
B) Negative integers.
C) Zero.
D) None of the above.
A) Positive integers.
B) Negative integers.
C) Zero.
D) None of the above.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
6
Exception handling helps you create ________ programs.
A) high-performance
B) logic-error-free
C) fault-tolerant
D) compilation-error-free
A) high-performance
B) logic-error-free
C) fault-tolerant
D) compilation-error-free
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
7
Which of the following statements is true?
A) The catch block contains the code that might throw an exception.
B) The try block contains the code that handles the exception if one occurs.
C) You can have many catch blocks to handle different types of exceptions.
D) When a try block terminates, any variables declared in the try block are preserved.
A) The catch block contains the code that might throw an exception.
B) The try block contains the code that handles the exception if one occurs.
C) You can have many catch blocks to handle different types of exceptions.
D) When a try block terminates, any variables declared in the try block are preserved.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
8
Which of the following statements about arrays are true? A. An array is a group of variables containing values that all have the same type.
B) Elements are located by index.
C) The length of an array c is determined by the expression
A) A, C, D.
B) A, B, D.
C) C, D.
C)length();. D. The zeroth element of array c is specified by c[0].
D) A, B, C, D.
B) Elements are located by index.
C) The length of an array c is determined by the expression
A) A, C, D.
B) A, B, D.
C) C, D.
C)length();. D. The zeroth element of array c is specified by c[0].
D) A, B, C, D.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
9
Which of the following will not produce a compiler error?
A) Changing the value of a constant after it is initialized.
B) Changing the value at a given index of an array after it is created.
C) Using a final variable before it is initialized.
D) All of the above will produce compiler errors.
A) Changing the value of a constant after it is initialized.
B) Changing the value at a given index of an array after it is created.
C) Using a final variable before it is initialized.
D) All of the above will produce compiler errors.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
10
Consider the code segment below. Which of the following statements is false? int[] g;
G = new int[23];
A) The value of g[3] is -1.
B) The first statement declares an array reference.
C) The second statement creates the array.
D) g is a reference to an array of integers.
G = new int[23];
A) The value of g[3] is -1.
B) The first statement declares an array reference.
C) The second statement creates the array.
D) g is a reference to an array of integers.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
11
Constant variables also are called .
A) write-only variables
B) finals
C) named constants
D) All of the above
A) write-only variables
B) finals
C) named constants
D) All of the above
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
12
What do the following statements do?
double[] array;
Array = new double[14];
A) Create a double array containing 13 elements.
B) Create a double array containing 14 elements.
C) Create a double array containing 15 elements.
D) Declare but do not create a double array.
double[] array;
Array = new double[14];
A) Create a double array containing 13 elements.
B) Create a double array containing 14 elements.
C) Create a double array containing 15 elements.
D) Declare but do not create a double array.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
13
Consider integer array values, which contains 5 elements. Which statements successfully swap the contents of the array at index 3 and index 4?
A) values[3] = values[4];
Values[4] = values[3];
B) values[4] = values[3];
Values[3] = values[4];
C) int temp = values[3];
Values[3] = values[4];
Values[4] = temp;
D) int temp = values[3];
Values[3] = values[4];
Values[4] = values[3];
A) values[3] = values[4];
Values[4] = values[3];
B) values[4] = values[3];
Values[3] = values[4];
C) int temp = values[3];
Values[3] = values[4];
Values[4] = temp;
D) int temp = values[3];
Values[3] = values[4];
Values[4] = values[3];
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
14
Which of the following statements about creating arrays and initializing their elements is false?
A) The new keyword should be used to create an array.
B) When an array is created with operator new, the number of elements must be placed in square brackets following the type of element being stored.
C) The elements of an array of integers have a value of null before they are initialized.
D) A for loop is commonly used to set the values of the elements of an array.
A) The new keyword should be used to create an array.
B) When an array is created with operator new, the number of elements must be placed in square brackets following the type of element being stored.
C) The elements of an array of integers have a value of null before they are initialized.
D) A for loop is commonly used to set the values of the elements of an array.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
15
Arrays are ________.
A) variable-length entities
B) fixed-length entities
C) data structures that contain up to 10 related data items
D) used to draw a sequence of lines, or "rays"
A) variable-length entities
B) fixed-length entities
C) data structures that contain up to 10 related data items
D) used to draw a sequence of lines, or "rays"
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
16
Attempting to access an array element outside of the bounds of an array, causes a(n) .
A) ArrayOutOfBoundsException.
B) ArrayElementOutOfBoundsException.
C) ArrayIndexOutOfBoundsException.
D) ArrayException.
A) ArrayOutOfBoundsException.
B) ArrayElementOutOfBoundsException.
C) ArrayIndexOutOfBoundsException.
D) ArrayException.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
17
A(n)________ indicates a problem that occurs while a program executes.
A) syntax error
B) omitted import
C) missing semicolon
D) exception
A) syntax error
B) omitted import
C) missing semicolon
D) exception
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
18
Which of the following initializer lists would correctly set the elements of array n?
A) int[] n = {1, 2, 3, 4, 5};.
B) array n[int] = {1, 2, 3, 4, 5};.
C) int n[5] = {1; 2; 3; 4; 5};.
D) int n = new int(1, 2, 3, 4, 5);.
A) int[] n = {1, 2, 3, 4, 5};.
B) array n[int] = {1, 2, 3, 4, 5};.
C) int n[5] = {1; 2; 3; 4; 5};.
D) int n = new int(1, 2, 3, 4, 5);.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
19
Which expression adds 1 to the element of array arrayName at index i?
A) ++arrayName[i].
B) arrayName++[i].
C) arrayName[i++].
D) None of the above.
A) ++arrayName[i].
B) arrayName++[i].
C) arrayName[i++].
D) None of the above.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
20
Which flag in a format specifier indicates that values with fewer digits than the field width should begin with a leading 0?
A) p.
B) l.
C) w.
D) 0.
A) p.
B) l.
C) w.
D) 0.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
21
Assume class Book has been declared. Which set of statements creates an array of Books?
A) Book[] books;
Books = new Book[numberElements];
B) Book[] books];
Books = new Book()[numberElements];
C) new Book() books[];
Books = new Book[numberElements];
D) All of the above.
A) Book[] books;
Books = new Book[numberElements];
B) Book[] books];
Books = new Book()[numberElements];
C) new Book() books[];
Books = new Book[numberElements];
D) All of the above.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
22
In array items, which expression below accesses the value at row 3 and column 4?
A) items[3].[4]
B) items[3[4]]
C) items[3][4]
D) items[3, 4]
A) items[3].[4]
B) items[3[4]]
C) items[3][4]
D) items[3, 4]
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
23
Assume array items contains the integer values 0, 2, 4, 6 and 8. Which of the following uses the enhanced for loop to display each value in array items?
A) for (int i = 0; i < items.length; i++) {
System.out.prinf("%d%n", items[i]);
}
B) for (int i : items) {
System.out.prinf("%d%n", items[i]);
}
C) for (int i : items) {
System.out.prinf("%d%n", i);
}
D) for (int i = 0 : items.length) {
System.out.prinf("%d%n", items[i]);
}
A) for (int i = 0; i < items.length; i++) {
System.out.prinf("%d%n", items[i]);
}
B) for (int i : items) {
System.out.prinf("%d%n", items[i]);
}
C) for (int i : items) {
System.out.prinf("%d%n", i);
}
D) for (int i = 0 : items.length) {
System.out.prinf("%d%n", items[i]);
}
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
24
Which set of statements totals the values in two-dimensional int array items?
A) int total = 0;
For (int subItems : items) {
For (int item : subItems) {
Total += item;
}
}
B) int total = 0;
For (int item: int[] subItems : items) {
Total += item;
}
C) int total = 0;
For (int[] subItems : items) {
For (int item : items) {
Total += item;
}
}
D) int total = 0;
For (int[] subItems : items) {
For (int item : subItems) {
Total += item;
}
}
A) int total = 0;
For (int subItems : items) {
For (int item : subItems) {
Total += item;
}
}
B) int total = 0;
For (int item: int[] subItems : items) {
Total += item;
}
C) int total = 0;
For (int[] subItems : items) {
For (int item : items) {
Total += item;
}
}
D) int total = 0;
For (int[] subItems : items) {
For (int item : subItems) {
Total += item;
}
}
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
25
When you pass an array or an individual array element of a reference type to a method, the called method receives ________. When you pass an individual element of a primitive type, the called method receives ________.
A) a copy of the element's reference, a copy of the element's reference
B) a copy of the element's value, a copy of the element's reference
C) a copy of the element's value, a copy of the element's value
D) a copy of the element's reference, a copy of the element's value
A) a copy of the element's reference, a copy of the element's reference
B) a copy of the element's value, a copy of the element's reference
C) a copy of the element's value, a copy of the element's value
D) a copy of the element's reference, a copy of the element's value
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
26
Which of the following statements is false?
A) When an argument is passed by reference, the called method can access the argument's value in the caller directly but cannot modify it.
B) All arguments in Java are passed by value.
C) To pass an individual array element to a method, use the indexed name of the array.
D) To pass an object reference to a method, simply specify in the method call the name of the variable that refers to the object.
A) When an argument is passed by reference, the called method can access the argument's value in the caller directly but cannot modify it.
B) All arguments in Java are passed by value.
C) To pass an individual array element to a method, use the indexed name of the array.
D) To pass an object reference to a method, simply specify in the method call the name of the variable that refers to the object.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
27
The preferred way to traverse a two-dimensional array is to use .
A) a do while statement.
B) a for statement.
C) two nested for statements.
D) three nested for statements.
A) a do while statement.
B) a for statement.
C) two nested for statements.
D) three nested for statements.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
28
An argument type followed by a(n) in a method's parameter list indicates that the method receives a variable number of arguments of that particular type.
A) square brackets ([])
B) ellipsis (...)
C) varargs keyword
D) All of the above are acceptable to indicate a variable number of arguments.
A) square brackets ([])
B) ellipsis (...)
C) varargs keyword
D) All of the above are acceptable to indicate a variable number of arguments.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
29
Which set of statements totals the items in each row of two-dimensional array items, and displays each row's total?
A) for (int row = 0; row < items.length; row++) {
Int total = 0;
For (int column = 0; column < items[row].length; column++) {
Total += items[row][column];
System.out.printf("Row %d's total is %d%n", row, total);
}
B) int total = 0;
For (int row = 0; row < items.length; row++) {
For (int column = 0; column < items[row].length; column++) {
Total += items[row][column];
}
System.out.printf("Row %d's total is %d%n", row, total);
}
C) int total = 0;
For (int row = 0; row < items.length; row++) {
For (int column = 0; column < items[column].length; column++) {
Total += items[row][column];
}
System.out.printf("Row %d's total is %d%n", row, total);
}
D) for (int row = 0; row < items.length; row++) {
Int total = 0;
For (int column = 0; column < items[column].length; column++) {
Total += items[row][column];
}
System.out.printf("Row %d's total is %d%n", row, total);
}
A) for (int row = 0; row < items.length; row++) {
Int total = 0;
For (int column = 0; column < items[row].length; column++) {
Total += items[row][column];
System.out.printf("Row %d's total is %d%n", row, total);
}
B) int total = 0;
For (int row = 0; row < items.length; row++) {
For (int column = 0; column < items[row].length; column++) {
Total += items[row][column];
}
System.out.printf("Row %d's total is %d%n", row, total);
}
C) int total = 0;
For (int row = 0; row < items.length; row++) {
For (int column = 0; column < items[column].length; column++) {
Total += items[row][column];
}
System.out.printf("Row %d's total is %d%n", row, total);
}
D) for (int row = 0; row < items.length; row++) {
Int total = 0;
For (int column = 0; column < items[column].length; column++) {
Total += items[row][column];
}
System.out.printf("Row %d's total is %d%n", row, total);
}
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
30
Consider array items, which contains the values 0, 2, 4, 6 and 8. If method changeArray is called with the method call changeArray(items, items[2]), what values are stored in items after the method has finished executing? public static void changeArray(int[] passedArray, int value) {
PassedArray[value] = 12;
Value = 5;
}
A) 0, 2, 5, 6, 12.
B) 0, 2, 12, 6, 8.
C) 0, 2, 4, 6, 5.
D) 0, 2, 4, 6, 12.
PassedArray[value] = 12;
Value = 5;
}
A) 0, 2, 5, 6, 12.
B) 0, 2, 12, 6, 8.
C) 0, 2, 4, 6, 5.
D) 0, 2, 4, 6, 12.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
31
Which of the following tasks cannot be performed using an enhanced for loop?
A) Calculating the product of all the values in an array.
B) Displaying all even element values in an array.
C) Comparing the elements in an array to a specific value.
D) Incrementing the value stored in each element of the array.
A) Calculating the product of all the values in an array.
B) Displaying all even element values in an array.
C) Comparing the elements in an array to a specific value.
D) Incrementing the value stored in each element of the array.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
32
An array with m rows and n columns is not ________.
A. an m-by-n array.
B. an n-by-m array.
C. a two-dimensional array.
D. a dual-transcripted array.
A) A and C.
B) A and D.
C) B and D.
D) B and C.
A. an m-by-n array.
B. an n-by-m array.
C. a two-dimensional array.
D. a dual-transcripted array.
A) A and C.
B) A and D.
C) B and D.
D) B and C.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
33
Which statement correctly passes the array items to method takeArray? Array items contains 10 elements.
A) takeArray(items[]).
B) takeArray(items).
C) takeArray(items[9]).
D) Arrays cannot be passed to methods-each item must be sent to the method separately.
A) takeArray(items[]).
B) takeArray(items).
C) takeArray(items[9]).
D) Arrays cannot be passed to methods-each item must be sent to the method separately.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
34
Which of the following sets of statements creates a multidimensional array with 3 rows, where the first row contains 1 value, the second row contains 4 items and the final row contains 2 items?
A) int[][] items;
Items = new int[3][?];
Items[0] = new int[1];
Items[1] = new int[4];
Items[2] = new int[2];
B) int[][] items;
Items = new int[3][];
Items[0] = new int[1];
Items[1] = new int[4];
Items[2] = new int[2];
C) int[][] items;
Items = new int[?][?];
Items[0] = new int[1];
Items[1] = new int[4];
Items[2] = new int[2];
D) int[][] items;
Items[0] = new int[1];
Items[1] = new int[4];
Items[2] = new int[2];
A) int[][] items;
Items = new int[3][?];
Items[0] = new int[1];
Items[1] = new int[4];
Items[2] = new int[2];
B) int[][] items;
Items = new int[3][];
Items[0] = new int[1];
Items[1] = new int[4];
Items[2] = new int[2];
C) int[][] items;
Items = new int[?][?];
Items[0] = new int[1];
Items[1] = new int[4];
Items[2] = new int[2];
D) int[][] items;
Items[0] = new int[1];
Items[1] = new int[4];
Items[2] = new int[2];
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
35
In Java, multidimensional arrays ________.
A) are not directly supported.
B) are implemented as arrays of arrays.
C) are often used to represent tables of values.
D) All of the above.
A) are not directly supported.
B) are implemented as arrays of arrays.
C) are often used to represent tables of values.
D) All of the above.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
36
For tthe array that was the correct answer in the previous question, what is the value returned by items[1][0]?
A) 4.
B) 8.
C) 12.
D) 6.
A) 4.
B) 8.
C) 12.
D) 6.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
37
What kind of application tests a class by creating an object of that class and calling the class's methods?
A) Pseudo application.
B) Debugger.
C) Declarator.
D) Test harness.
A) Pseudo application.
B) Debugger.
C) Declarator.
D) Test harness.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
38
Which of the following statements creates a multidimensional array with 3 rows, where the first row contains 1 element, the second row contains 4 elements and the final row contains 2 elements?
A) int[][] items = {{1, null, null, null}, {2, 3, 4, 5}, {6, 7, null, null}};
B) int[][] items = {{1}, {2, 3, 4, 5}, {6, 7}};
C) int[][] items = {{1}, {2, 3, 4, 5}, {6, 7}, {});
D) int[][] items = {{1}, {4}, {2}};
A) int[][] items = {{1, null, null, null}, {2, 3, 4, 5}, {6, 7, null, null}};
B) int[][] items = {{1}, {2, 3, 4, 5}, {6, 7}};
C) int[][] items = {{1}, {2, 3, 4, 5}, {6, 7}, {});
D) int[][] items = {{1}, {4}, {2}};
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
39
How many Book objects are created by the following statement? Book[] books = new Book[10];
A) 10
B) 0
C) 5
D) None of the above.
A) 10
B) 0
C) 5
D) None of the above.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
40
Which statement below initializes array items to contain 3 rows and 2 columns?
A) int[][] items = {{2, 4}, {6, 8}, {10, 12}};
B) int[][] items = {{2, 6, 10}, {4, 8, 12}};
C) int[][] items = {2, 4}, {6, 8}, {10, 12};
D) int[][] items = {2, 6, 10}, {4, 8, 12};
A) int[][] items = {{2, 4}, {6, 8}, {10, 12}};
B) int[][] items = {{2, 6, 10}, {4, 8, 12}};
C) int[][] items = {2, 4}, {6, 8}, {10, 12};
D) int[][] items = {2, 6, 10}, {4, 8, 12};
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
41
Which method call converts the value in variable stringVariable to an integer?
A) Convert.toInt(stringVariable)
B) Convert.parseInt(stringVariable)
C) Integer.parseInt(stringVariable)
D) Integer.toInt(stringVariable)
A) Convert.toInt(stringVariable)
B) Convert.parseInt(stringVariable)
C) Integer.parseInt(stringVariable)
D) Integer.toInt(stringVariable)
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
42
Which command below runs TestProgram, and passes in the values files.txt and 3?
A) java TestProgram files.txt 3.
B) java TestProgram files.txt, 3.
C) java TestProgram "files.txt", "3".
D) None of the above.
A) java TestProgram files.txt 3.
B) java TestProgram files.txt, 3.
C) java TestProgram "files.txt", "3".
D) None of the above.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
43
Class Arrays methods sort, binarySearch, equals and fill are overloaded for primitive-type arrays and Object arrays. In addition, methods __________ and __________ are overloaded with generic versions.
A) sort, binarySearch.
B) sort, fill.
C) binarySearch, equals.
D) binarySearch, fill.
A) sort, binarySearch.
B) sort, fill.
C) binarySearch, equals.
D) binarySearch, fill.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
44
Class ________ represents a dynamically resizable array-like data structure.
A) Array
B) ArrayList
C) Arrays
D) None of the above.
A) Array
B) ArrayList
C) Arrays
D) None of the above.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
45
Which of the following is false?
A) The size of an ArrayList can be determined via its length instance variable.
B) The size of an ArrayList can be determined via its size method.
C) You can add a new item to the end of an ArrayList with its add method.
C) You can get an item from a specified index in an ArrayList with its get method.
A) The size of an ArrayList can be determined via its length instance variable.
B) The size of an ArrayList can be determined via its size method.
C) You can add a new item to the end of an ArrayList with its add method.
C) You can get an item from a specified index in an ArrayList with its get method.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
46
Class Arrays provides method __________ for comparing arrays to determine whether they have the same contents.
A) compare
B) compares
C) equal
D) equals
A) compare
B) compares
C) equal
D) equals
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck