Thursday, 2 February 2017

iNTERFACE : Default Method






interface Mythical {
    default public String identifyMyself() {
        return "I am a mythical creature.";
    }
}

public class DefaultMethodTest implements Mythical{

        public static void main(String[] args)
        {
            DefaultMethodTest dmt = new DefaultMethodTest();
            System.out.print(dmt.identifyMyself());
        }
}

No comments:

Post a Comment