Inheritance and delegation in java