How to use inheritance in java to inherit a class.