



Let be specific. Java Does NOT support - multiple IMPLEMENTATION Inheritance, but but wait JAVA SUPPORTS MULTIPLE INTERFACE INHERITANCE How? One of the way it can do is using the Adapter pattern.
e.g. consider and Employee class which needs to extend 2 concrete classes say Person and Employment So guys lets do it this upfront now create 2 interfaces viz. 1. PersonLike* which will be implemented by the concrete class Person and 2. EmployeeLike* which will be implemented by the concrete class Employment
Suppose the PersonLike interface is:
public interface PersonLike {
String getName();
int getAge();
}
and the EmployeeLike interface is:
public interface EmployeeLike {
float getSalary();
java.util.Date getHireDate();
}
Here is how our Employee class which needs to extend 2 concrete classes say Person and Employment as below
public class **Employee** extends **Person** implements PersonLike, **EmployeeLike** {
private EmployeeLike employment = new
Employment();
public float getSalary() { return
employment.getSalary(); }
public java.util.Date getHireDate() { return
employment.getHireDate(); }
}
}
As in the above example we have extended Person, so there is no need for the implementation, but for Employment to be extended we create a variable(employment) of type EmployeeLike. This variable will then be used to implement the Interface methods for the interface EmployeeLike.
Hope I am clear.
I got this cleared using the below link
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.