Kotlinlearncs.online LogoJava
Return to List

Homework: Bracket an Anonymous Class

Created By: Geoffrey Challen
/ Version: 2020.10.0

Declare a public class Bracketer providing one static method create. create takes a single int parameter and returns an anonymous object that implements the Bracket interface:

The returned object should implement top so that it returns the passed int and bottom so that it returns the passed int * -1. So, for example:

Related Lessons

Stuck? You may find these lessons helpful: