Chapter 8, exercise 6 answer

From CompSciWiki
Revision as of 14:52, 20 March 2007 by Umalvar6 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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);
    }
}