February 2014
Beginner
1248 pages
62h 25m
English
Class GradeBook (Fig. 7.14) uses an array of ints to store several students’ grades on a single exam. Array grades is declared as an instance variable (line 7), so each GradeBook object maintains its own set of grades. The constructor (lines 10–14) has two parameters—the name of the course and an array of grades. When an application (e.g., class GradeBookTest in Fig. 7.15) creates a GradeBook object, the application passes an existing int array to the constructor, which assigns the array’s reference to instance variable grades (line 13). The grades array’s size is determined by the length instance variable of the constructor’s array parameter. Thus, a GradeBook object can process a variable ...
Read now
Unlock full access