what does -> do in java code example

Example 1: java "->"

interface LambdaFunction {
    void call();
}
class FirstLambda {
    public static void main(String []args) {
        LambdaFunction lambdaFunction = () -> System.out.println("Hello world");
        lambdaFunction.call();
    }
}

Example 2: >> and >>> operators in java

>> is a right shift operator shifts all of the bits in a value to the 
right to a specified number of times.
int a =15;
a= a >> 3;
The above line of code moves 15 three characters right.

>>> is an unsigned shift operator used to shift right. The places which 
were vacated by shift are filled with zeroes

Example 3: java "->"

Runnable r = ()-> System.out.print("Run method");

// is equivalent to

Runnable r = new Runnable() {
            @Override
            public void run() {
                System.out.print("Run method");
            }
        };

Tags:

Java Example