Created
March 2, 2019 14:22
-
-
Save Yatharth0045/8da89fb8362629090cea6aeb17d08ac5 to your computer and use it in GitHub Desktop.
Its giving an error because of mismatch return type.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Interface { | |
int add(int x,int y); | |
} | |
class MethodReference { | |
void sum(int a,int b){ | |
System.out.println(a+b); | |
//return a+b; | |
} | |
public static void main(String[] args) { | |
Interface i = new MethodReference()::sum; | |
i.add(10,20); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment