Lambda Expressions in java : Lambda expressions basically express instances of functional interfaces (An interface with single abstract method is called functional interface. An example is java.lang.Runnable). lambda expressions implement the only abstract function and therefore implement functional interfaces lambda expressions are added in Java 8 and provide below functionalities. Enable to treat functionality as a method argument, or code as data.A function that can be created without belonging to any class.A lambda expression can be passed around as if it was an object and executed on demand.Example :class Test { public static void main(String args[]) { // lambda expression to implement above // functional interface. This interface // by default implements abstractFun() FuncInterface fobj = (int x)->System.out.println(2*x); // This calls above lambda expression and prints 10. fobj.abstractFun(5); } } - Study24x7
Social learning Network
study24x7

Default error msg

Login

New to Study24x7 ? Join Now
Already have an account? Login
22 Apr 2019 04:24 PM study24x7 study24x7

Lambda Expressions in java :
Lambda expressions basically express instances of functional interfaces (An interface with single abstract method is called functional interface. An example is java.lang.Runnable). lambda expressions implement the only abstract function an...

See more

2-55-new-features-java-se-8-2202551-zhs.pdf
3 Downloads
study24x7
Write a comment
Related Questions
500+   more Questions to answer
Most Related Articles