in JAVA by
What exactly does an interface's default method do?

1 Answer

0 votes

The methods that are declared to use the default keyword are the default methods. Prior to Java 8, it is not possible to define methods inside the interface; however, starting with Java 8, you can do so by utilising default methods. Because it enables you to develop the interface after release, this is also known as the "defender technique." By using the default keyword, you may now introduce new methods without disrupting all the clients. JDK 8 has greatly benefited from this, adding several important methods including for Each() and stream() as default methods to already existing types like Iterable and Collection.

Related questions

0 votes
asked May 31, 2022 in JAVA by Robin
0 votes
asked Mar 16, 2021 in JAVA by Robindeniel
+1 vote
asked Mar 25, 2020 in SAP by Hodge
+1 vote
asked Feb 14, 2020 in JAVA by rahuljain1