Write a program to concatenate two strings using lambda expressions.
The lambda expression takes two strings as argument and returns the concatenated string.
Input format
The input consists of two strings.
Output format
The output prints the concatenated string.
Sample test cases
Input 1 Hello World Output 1 Hello World
import java.util.function.*;
import java.util.Scanner;
class Main{
//sauravhathi
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String saurav1 = sc.nextLine();
String saurav2 = sc.nextLine();
Consumer<String> c = (x) -> System.out.println(x);
c.accept(saurav1+" "+saurav2);
}
}
Happy Learning – If you require any further information, feel free to contact me.