What is the value of the variable named len after the code that follows is executed?
int[][] nums = { {1, 2, 3}, {3, 4, 5, 6, 8}, {1}, {8, 8} };
int len = nums[2].length;
1
What is printed to the console when the code that follows is executed?
int[][] points = { {8,3}, {4,3}, {7,2} };
String s = "";
for (int i = 0; i < points.length; i++)
{
Arrays.sort(points[i]);
for (int j = 0; j < points[i].length; j++)
{
s += points[i][j
383427
How many rows are in the array that follows?
Rental[][] transactions = new Rental[7][3];
7
What does the x represent in the following declaration?
BigDecimal[][] sales = new BigDecimal[x][y];
the number of arrays in the sales array
What is printed to the console after the code that follows is executed?
int[][] types = new int[4][];
for (int i = 0; i < types.length; i++)
{
types[i] = new int[i+1];
}
System.out.println(types[1].length);
2
What is the value of times[2][1] in the array that follows?
double[][] times = { {23.0, 3.5}, {22.4, 3.6}, {21.3, 3.7} };
3.7
What is the value of temps[2][1] after the code that follows is executed?
double[][] temps = new double[10][5];
for (int i = 0; i < temps.length; i++)
{
for (int j = 0; j < temps[i].length; j++)
{
temps[i][j] = j + i;
}
}
3.0
What is the value of the variable named lists after the statements that follow are executed?
String[][] names = new String[200][10];
int lists = names.length;
200
What is the value of the variable named len after the code that follows is executed?
int[][] nums = { {1, 2, 3}, {3, 4, 5, 6, 8}, {1}, {8, 8} };
int len = nums.length;
4
Which of the following is an invalid two-dimensional array definition?
a. double[][] values = new double[2][8];
b. double[][] values = new double[][8];
c. double[][] values = new double[8][];
d. double values[][] = new double[8][2];
double[][] values = new double[][8];
Since the sort method of the Arrays class can sort String objects, what must be true of the String class?
It implements the Comparable interface.