How to extend a final class in Java

You can’t, basically. It looks like the developer who designed Bar intended for it not to be extended – so you can’t extend it. You’ll need to look for a different design – possibly one which doesn’t use inheritance so much… assuming you can’t change the existing code, of course.

(It’s hard to give more concrete advice without knowing more about the real goal here – the design of the overall system.)

Leave a Comment