Kotlinlearncs.online LogoJava
Return to List

Solve: Last In List

Created By: Geoffrey Challen
/ Version: 2022.7.0

Write a method named lastInList that accepts a single List<?> of items and returns the last element as an Object. The list will contain at least one element. Don't overthink this! The solution is a single line of code.

Related Lessons

Stuck? You may find these lessons helpful:

Report a Problem

Attribution must link to this page: https://www.learncs.online/solve/java/last-in-list/[email protected]