[Solved] Write a program to concatenate two strings using lambda expressions

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.

Share your love
Saurav Hathi

Saurav Hathi

I'm currently studying Bachelor of Computer Science at Lovely Professional University in Punjab.

πŸ“Œ Nodejs and Android 😎
πŸ“Œ Java

Articles: 444

Leave a Reply

Your email address will not be published. Required fields are marked *