Challenge 3: Object Expression Implementing an Interface — Solution interface Validator { fun isValid(input: String): Boolean } fun checkInput(text: String, validator: Validator) { println("\"$text\" is valid: ${validator.isValid(text)}") } fun main() { val lengthValidator = object : Validator { override fun isValid(input: String): Boolean { return input.isNotBlank() && input.length >= 3 } } checkInput("hi", lengthValidator) checkInput("hello", lengthValidator) checkInput(" ", lengthValidator) } /* Output: "hi" is valid: false "hello" is valid: true " " is valid: false Notes: - "object : Validator { ... }" creates a one-off, unnamed class that implements Validator on the spot, with no separate named class needed anywhere in the file. - checkInput() only knows about the Validator interface — it has no idea the actual implementation is an anonymous object expression, which is exactly the point: it's usable anywhere a Validator is expected. - "hi" fails (length 2 < 3), "hello" passes, and " " fails isNotBlank() even though its length is 3. */