I have been reading a book called "Head First Design Patterns-A brain friendly guide" by Eric Freeman & Elizabeth Robson. All of their examples are in Java.
On page 15, what they have done is:
- In a duck class, two variables of interface type are declared. Please see the image.
As a newbie in Java, I have always thought the way to utilize interface is via "implement", but this example surely got me thinking.
May I ask if it is a common practice to use interface this way? I could have completely missed something here.
Thank you