Q: What are default methods in interfaces, and why were they introduced?
A: Default methods are methods in interfaces that have a body. They were introduced to allow the addition of new methods to interfaces without breaking the existing implementations. This feature enhances backward compatibility and facilitates the evolution of APIs. Before Java 8, interfaces in Java could only contain method signatures (abstract methods) but no method implementations. This characteristic limited the evolution of interfaces once they were published and used by clients. If a developer wanted to add new methods to an interface, all classes implementing this interface would break because they would need to implement the new methods. You can read more on the default method.
Q: What is a functional interface?
A: A functional interface is an interface that contains exactly one abstract method, but it can have multiple default or static methods. These interfaces are intended to be used as the assignment target for lambda expressions and method references.