What is the purpose of the `default` keyword in an interface?

Java Professional Easy

Java Professional — Easy

What is the purpose of the `default` keyword in an interface?

Key points

  • `default` keyword allows adding method implementations in interfaces
  • Helps in backward compatibility with existing implementations
  • Does not declare constants or prevent method overriding

Ready to go further?

Related questions