Olivia Johnson wrote:
The explanation says
Line 10 includes an unhandled checked IOException, while line 11 includes an unhandled checked FileNotFoundException
but none of BufferedInputStream's constructors declare a checked Exception.
If you compile code as it is, compiler will complain only about incompatible casting from Object to Bird.
If you fix it adding appropriate cast, compiler will show compile errors on other lines, including line 9 - "exception thrown from implicit call to close() on resource variable 'is'".
Compiler flags unhandled exceptions, thrown by close() method of the variable in try-with-resourses statement, at the point of declaration of such variable.