Method displayMessage
(lines 22–28) does not return any data when it completes its task, so its return type is void
. The method does not receive parameters, so the parameter list is empty. Lines 26–27 output a welcome message that includes the value of instance variable courseName
, which is returned by the call to method getCourseName
in line 27. Notice that one method of a class (displayMessage
in this case) can call another method of the same class by using just the method name (getCourseName
in this case).