← Back to Classes
Question 192
Override toString in Student
Override toString in Student
APersonclass is provided with anamefield. Complete theStudentclass that extendsPerson. Requirements: 1.Studenthas an additionalint gradefield. 2. The constructor takesnameandgrade, callingsuper(name)for the name. 3. OverridetoString()to return the format:"<name> - Grade <grade>". Do NOT write a main method.
Expected Output:
Alice - Grade 10= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
InheritanceClasses
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (sysout, psvm, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.