You are extending Exception
, a checked exception, this means that any method which throws that exception needs to say so:
Zoo(int capacity) throws ZooException {
And any code calling that constructor will have to try {} catch {}
or throw it again.
If you don't want it to be checked, use extends RuntimeException
instead