... remainder of printArray is identical to the versions presented in Fig. 20.1.

Testing the Generic printArray Method

As in Fig. 20.1, the program in Fig. 20.3 begins by declaring and initializing six-element Integer array integerArray (line 7), seven-element Double array doubleArray (line 8) and five-element Character array characterArray (line 9). Then each array is output by calling printArray (lines 12, 14 and ...

Get Java How to Program, Early Objects, 11th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.