JeffGrigg icon

ScannerSpaceJoin

JeffGrigg | PRO | 04/18/25 12:39:52 AM UTC | 0 ⭐ | 24008 👁️ | Never ⏰ | []
Java 5 |

0 B

|

Source Code

|

0 👍

/

0 👎

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);
    }
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎