All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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() {

    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy