Using Lambda Expression Java

import org.testng.annotations.Test;

interface MultiplyByTwo
int Multiply(int num);

interface MathOperation
int operation(int a,int b);

interface Number
double getValue();

interface Message
String getMessage(String msg);
public class Lambda2 {

public void testLambda2()
MathOperation add=(int a,int b) ->a+b;
MultiplyByTwo two=(int a) ->a*2;
Number num=()->100.80;
Message mess=(String msg)->msg.toLowerCase();
System.out.println(“Message seen is “+mess.getMessage(“HELLO WORLD”));
System.out.println(“Value seen is “+num.getValue());
System.out.println(“Multiplication seen is “+two.Multiply(10));


About qainterviews

Software Geek,QA Expert,Blogger
This entry was posted in Java, Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s