Possible Duplicate:
What does it mean to “program to an interface”?
First of all I think there are difference between the term interface and interface in java and I dont quite get what the difference is.
My first question when it says "Program to an interface rather than to an implementation" is that mean Interface or java Interface?
Im reading headfirst design patterns and I confused about program to an interface rather than program to an implementation. My understanding is that SUBCLASS IS THE CONCRETE IMPLEMENTATION and the INTERFACE is the SUPERCLASS(interface or abstract class or simpleclass).
My Second question is when they say program to an interface is that mean that the code is in the INTERFACE(superclass) then subclass just inherited it?? and if they say program to IMPLEMENTATION(subclass) the code is in the subclass?? I think about this because of the the term "ReUse", because if you change your code and your code is in the Subclass(concrete implementation) then you need to change all you subclass codes, then if you put your codes in the interface you just need to change the code in that interface.
also examples(please make it easy) of program to an interface and implementation will help.
3rd question what is the advantages if we program to an interface than if we program to concrete classes?