Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.function.Function;

public class Main {
    public static void main(String[] argv) {
        // Using  a  lambda  expression
        Function<Integer, String> func1 = x -> Integer.toBinaryString(x);
        System.out.println(func1.apply(10));

        // Using  a  method  reference
        Function<Integer, String> func2 = Integer::toBinaryString;
        System.out.println(func2.apply(10));
    }
}