edu.pdx.cs410J.java8.DefaultMethods Maven / Gradle / Ivy
The newest version!
package edu.pdx.cs410J.java8;
public class DefaultMethods {
public interface InterfaceWithDefaultMethod {
default void defaultMethod() {
}
}
public interface AnotherInterfaceWithDefaultMethod {
default void defaultMethod() {
}
}
class WhatHappensWithTwoInterfacesWithSameDefaultMethod implements InterfaceWithDefaultMethod, AnotherInterfaceWithDefaultMethod {
/**
* If you don't override this method, this class won't compile because the
* compiler cannot determine which defaultMethod
implementation
* should be associated with this class.
*/
@Override
public void defaultMethod() {
}
}
}