January 2014
Intermediate to advanced
736 pages
70h 43m
English
Sometimes you’ll want to initialize objects with multiple data items. In Exercise B.11, we ask you to store the course name and the instructor’s name in a GradeBook object. In this case, the GradeBook’s constructor would be modified to receive two Strings, as in
public GradeBook( String courseName, String instructorName )
and you’d call the GradeBook constructor as follows:
GradeBook gradeBook = new GradeBook( "CS101 Introduction to Java Programming", "Sue Green" );
Read now
Unlock full access