Class StudentTest
To demonstrate the nested if
...else
statements in class Student
’s getLetterGrade
method, class StudentTest
’s main
method (Fig. 4.5) creates two Student
objects (lines 7–8). Next, lines 10–13 display each Student
’s name and letter grade by calling the objects’ getName
and getLetterGrade
methods, respectively.
Get Java™ How To Program (Early Objects), Tenth 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.