January 2014
Intermediate to advanced
736 pages
70h 43m
English
In our next application (Figs. B.5–B.6), class GradeBook (Fig. B.5) maintains the course name as an instance variable so that it can be used or modified at any time during an application’s execution. The class contains three methods—setCourseName, getCourseName and displayMessage. Method setCourseName stores a course name in a GradeBook. Method getCourseName obtains a GradeBook’s course name. Method displayMessage, which now specifies no parameters, still displays a welcome message that includes the course name; as you’ll see, the method now obtains the course name by calling a method in the same class—getCourseName.
1 // Fig. B.5: GradeBook.java ...
Read now
Unlock full access