Hi,
I think there is an errata on Chapter 8, on the
Review Questions:
On the explanation of Question 2 (tb864585.JaSE17SG.c08.02):
Options:
A. ok
B. too high
C. Compiler error on line 7
D. Compiler error on line 10
E. Compiler error on a different line
F. A runtime exception is thrown.
Explanation:
The interface takes two int parameters. The code on line 7 attempts to use them as if h is a String making option C correct. It is tricky to use types in a lambda when they are implicitly specified. Remember to check the interface for the real type.
Shouldn't it be "The code on line 7 attempts to use them as if h is a StringBuilder" ?
Thanks,
João