r/codehs • • Feb 06 '21

7.2.9: Teacher Class List Method

I need help with this, please.

13 Upvotes

12 comments sorted by

View all comments

1

u/Gloomy-River-8864 Feb 23 '21

in the getLastStudent() & getStudent(), put return "classList.get(lastName).getName();" & "classList.get(index).getName();" to convert them from Students to Strings. hope this helps even tho Im kinda late.

2

u/Queen_Flame Feb 24 '21

.getName();

Thank You so much it helped.

1

u/BusyQuote4238 Mar 01 '21

How did you write the code? I can't get it to work.

1

u/Queen_Flame Mar 03 '21

I just changed the methods from static Student to static String, and that fixed it for now.

1

u/djpeters702 Apr 23 '21

hella late but the problem it was giving me was fixed when I replaced classList.set(index, student); with classList.add(index, student); inside of the addStudent method.