Java For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming

Self-Test Questions

1. 

Arrays are contiguously allocated memory elements of homogeneous data types. Explain in your own words what this means.

2. 

What’s the difference between arrays of primitive types vs. arrays of reference types?

3. 

Java array types directly subclass what Java class?

4. 

Every Java array type has a corresponding object of this type in memory. What type is it?

5. 

What two interfaces do Java array types implement?

6. 

How do you determine the length of an array?

7. 

Java multidimensional arrays are _______________ of ______________.

8. 

When a multidimensional array is created which dimensions are optional and which dimensions are mandatory?

9. 

What is meant by the term “ragged array”?

10. 

What’s the purpose of the main() method String array?

Answers

1. 

- the primitive type values or references the array contains are located one after the other in memory

2. 

- the elements of an array of primitive types contain actual values; the elements of reference type arrays contain references to objects created in the heap

3. 

- java.lang.Object

4. 

- java.lang.Class

5. 

- Cloneable, Serializable

6. 

- by accessing the length attribute of the array reference

7. 

- arrays of arrays

8. 

- the leftmost dimensions are mandatory and the rightmost dimension is optional

9. 

- a multidimensional array with varying length rightmost array dimensions

10. 

- enables the passing of command-line arguments into a program

Категории