MIT-Curricular/OOP/Java/Lab/Week9/concat_5.java

15 lines
530 B
Java
Raw Normal View History

2024-10-14 02:39:38 +05:30
import java.util.Scanner;
public class concat_5 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String concatString = "";
System.out.println("Enter five strings separately:");
for (int i = 1; i<= 5; i++) {
System.out.print("Enter string " + i + ": ");
String inputString = sc.nextLine();
concatString.concat(inputString);
}
System.out.println("Concatenated String: " + concatString);
}
}