Skip to content

Instantly share code, notes, and snippets.

@Yatharth0045
Created March 2, 2019 14:22
Show Gist options
  • Save Yatharth0045/8da89fb8362629090cea6aeb17d08ac5 to your computer and use it in GitHub Desktop.
Save Yatharth0045/8da89fb8362629090cea6aeb17d08ac5 to your computer and use it in GitHub Desktop.
Its giving an error because of mismatch return type.
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