Stephan van Hulst wrote:The reason is because of the history of the Java language.
Static methods in interfaces were only added in Java 8. By that time, many classes were written that implement existing interfaces. When the developers allowed for static methods to be added to interfaces, they wanted to make sure that existing classes didn't suddenly break because the interface that they implemented had added a static method that happens to have the same name as a method in the class.
If interfaces had supported static methods from the very beginning, the first snippet of code probably would have caused a compilation error as well.