001package edu.pdx.cs410J.java8; 002 003public class DefaultMethods { 004 005 public interface InterfaceWithDefaultMethod { 006 default void defaultMethod() { 007 008 } 009 } 010 011 public interface AnotherInterfaceWithDefaultMethod { 012 default void defaultMethod() { 013 014 } 015 } 016 017 class WhatHappensWithTwoInterfacesWithSameDefaultMethod implements InterfaceWithDefaultMethod, AnotherInterfaceWithDefaultMethod { 018 /** 019 * If you don't override this method, this class won't compile because the 020 * compiler cannot determine which <code>defaultMethod</code> implementation 021 * should be associated with this class. 022 */ 023 @Override 024 public void defaultMethod() { 025 026 } 027 } 028}