Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Test
- {
- public static void main(String[] args)
- {
- testAdder(Test::add);
- }
- public static void testAdder(Adder adder)
- {
- System.out.println(adder.add(1, 2));
- }
- public static int add(int a, int b)
- {
- return a + b;
- }
- @FunctionalInterface
- interface Adder
- {
- int add(int a, int b);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement