Java Reference
In-Depth Information
26 . In column processing, a two-dimensional array is processed one column at a time.
27 . Java stores two-dimensional arrays in a row order form in computer
memory.
28 . In addition to arrays, Java provides the class Vector to implement a list.
29 . Unlike an array, the size of a Vector object can grow and shrink during
program execution.
EXERCISES
1. Mark the following statements as true or false.
a. A double type is an example of a primitive data type.
b. A one-dimensional array is an example of a structured data type.
c. Arrays can be passed as parameters to a method.
d. A method can return a value of the type array .
e. The size of an array is determined at compile time.
f. Given the declaration:
int [] list = new int [10];
the statement:
list[5] = list[3] + list[2];
updates the content of the fifth element of the array list .
g. If an array index goes out of bounds, the program terminates in an error.
2. Consider the following declaration:
double [] salary = new double [10];
In this declaration, identify the following:
a. The array name.
b. The array size.
c. The data type of each array component.
d. The range of values for the index of the array.
9
Identify error(s), if any, in the following array declarations.
3.
int [] list = new int [10];
a.
final int size = 100;
b.
double [] list = new double [SIZE];
int [] numList = new int [0..9];
c.
String[] names = new String[20];
d.
scores double = new double [50];
e.
 
Search WWH ::




Custom Search