JDK8中对接口规范进行了新的定义,允许在接口中定义默认方法(使用default关键字修饰),静态方法,同时还推出了函数式接口(使用@FunctionInterface注解描述)设计。
package com.cnblogs.newStu;
public interface TestInter {
    default void show(){
        System.out.println("default!!!");
    }
    default void say(){
        System.out.println("hello!!!");
    }
    void stu();
}
class TestInterImpl implements TestInter{
    public static void main(String[] args) {
        TestInterImpl testInter = new TestInterImpl();
        testInter.show();
        testInter.say();
        testInter.stu();
    }
    //必须要重写
    @Override
    public void stu() {
        System.out.println("我");
    }
}
/*
default!!!
hello!!!
我
*/
package com.cnblogs.newStu;
public interface TestInter2 {
    static void show(){
        System.out.println("我来了!!!");
    }
}
class study{
    public static void main(String[] args) {
        TestInter2.show();
    }
}
//我来了!!!
Java8引入了一个是函数式接口(Functional Interfaces),此接口使用
@FunctionalInterface修饰,并且此接口内部只能包含一个抽象方法。
package com.cnblogs.newStu;
@FunctionalInterface
public interface TestInter3 {
    void show();
}
函数式接口推出的目的主要是为了配合后续Lambda表达式的应用。
@FunctionalInterface
public interface Consumer<T> {
    void accept(T t);
}
@FunctionalInterface
public interface Function<T, R> {
    R apply(T t);
}
@FunctionalInterface
public interface Predicate {
boolean test(T t);
}
@FunctionalInterface
public interface Supplier<T> {
    T get();
}
原文:https://www.cnblogs.com/fangweicheng666/p/15306070.html