January 2014
Intermediate to advanced
736 pages
70h 43m
English
We now declare class GradeBook (Fig. B.3) with a displayMessage method that displays the course name as part of the welcome message. (See the sample execution in Fig.B.4.) The new method requires a parameter that represents the course name to output.
1 // Fig. B.3: GradeBook.java 2 // Class declaration with one method that has a parameter. 3 4 public class GradeBook 5 { 6 // display a welcome message to the GradeBook user 7 public void displayMessage( String courseName ) 8 { 9 System.out.printf( "Welcome to the grade book for\n%s!\n",10 courseName ); 11 } // end method ...
Read now
Unlock full access