Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Interface Clarification

Tags:

java

interface

I am confused with a line in Oracle Java docs here under the heading Interfaces In Java, which says:

Method bodies exist only for default methods and static methods.

As we cannot define method body in interface, I am confused if this line has some other meaning. Appreciate if somebody can help me in understanding this.

like image 860
sf9251 Avatar asked Mar 18 '23 08:03

sf9251


1 Answers

In Java 8, interfaces may contain default implementations for their methods, as well as implemented static methods.

like image 129
Eran Avatar answered Mar 27 '23 14:03

Eran