Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- System.out.println("Enter the strings to join");
- String s1 = sc.nextLine();
- String s2 = sc.nextLine();
- String s3 = sc.nextLine();
- System.out.println("Enter delimiter[like -/./ ]: ");
- String delimiter = sc.nextLine();
- System.out.println("delimiter is >" + delimiter + "<");
- String result = String.join(delimiter, s1, s2, s3);
- System.out.println(result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement