Method displayMessage

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).

Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.