Darla SandyKnowledge Contributor
What is the 'default' keyword used for in interfaces?
What is the 'default' keyword used for in interfaces?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Questions | Answers | Discussions | Knowledge sharing | Communities & more.
In Java, the default keyword is used in interfaces to provide a default implementation for methods. Before Java 8, interfaces could only contain abstract methods without an implementation. The introduction of default methods allows interfaces to have methods with a body, which can be inherited by classes that implement the interface without the need for an overriding implementation.