Chapter 8, exercise 6 answer

From CompSciWiki
Jump to: navigation, search

Note: this does not need to be Object; it can be any variable or object type (such as int).

void printArray (Object[] array) {
    int j = 0;

    for (j = 0; j < array.length; j++) {
        System.out.println(array[j].toString);
    }
}