Class GradeBook
The GradeBook
class declaration (Fig. B.1) contains a displayMessage
method (lines 7–10) that displays a message on the screen. We’ll need to make an object of this class and call its method to execute line 9 and display the message.
The class declaration begins in line 4. The keyword public
is an access modifier. For now, we’ll simply declare every class public
. Every class declaration contains keyword class
followed immediately by the class’s name. Every class’s body is enclosed in a pair of left and right braces, as in lines 5 and 11 of class GradeBook
.
In Appendix A, each class we declared had one method named main
. Class GradeBook
also has one method—displayMessage
(lines 7–10). Recall that main
is a special method that’s ...
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.