Class GradeBookTest
Next, we’ll use class GradeBook
in an application. As you learned in Appendix A, method main
begins the execution of every application. A class that contains method main
begins the execution of a Java application. Class GradeBook
is not an application because it does not contain main
. Therefore, if you try to execute GradeBook
by typing java GradeBook
in the command window, an error will occur. To fix this problem, we must either declare a separate class that contains a main
method or place a main
method in class GradeBook
. To help you prepare for the larger programs you’ll encounter later in this book and in industry, we use a separate class (GradeBookTest
in this example) containing method main
to test each new class we ...
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.