Lambda can only be used with functional interface?

前端 未结 4 1444
盖世英雄少女心
盖世英雄少女心 2020-12-13 20:26

I did this:

public class LambdaConflict
{
    public static void main(String args[]){
        //*
        System.out.println(LambdaConflict.get(
                     


        
4条回答
  •  一整个雨季
    2020-12-13 21:28

    Think about it:

    • How should the compiler know if you want to override get1 or get2?

    • If you only override get1, what will be get2's implementation? Even the code you commented out won't work because you don't implement get2...

    There are reasons for this limitation...

提交回复
热议问题