Inheritance and delegation in Java