I've came into this question and response when trying to prepare for Java OCA exam.
Imagine you are working with another team to build an application. You are developing code that uses a class that the other team has not finished writing yet. Which element of Java would best facilitate this development, allowing easy integration once the other team’s code is complete?
A. An abstract class
B. An interface
I've answered A but the true answer was B.
The reason was:
The key here is understanding which of these features of Java allow one developer to build their application around another developer’s code, even if that code is not ready yet. For this problem, an interface is the best choice. If the two teams agree on a common interface, one developer can write code that uses the interface, while another developer writes code that implements the interface. Assuming neither team changes the interface, the code can be easily integrated once both teams are done. For these reasons, Option B is the correct answer.
I don't understand how you can use an interface without implementing it.
You can't write an abstract class since you don't really want to write code that gets thrown away. The other team will deliver its class eventually, so every effort you put into your abstract class is very likely to be waste.
Implementing a clean interface gives you and the other team a very good idea about what you need, so implementing this should be straight forward.