I'm new to Java and trying to split multiple strings and store it in a String array. The layman program follows:
    Scanner sc = new Scanner(System.in);
    String s1 = "Hello1 Hello2";
    String s2 = "Hello3 Hello4";
    String s3 = "Hello5 Hello6";
    String[] parts = s1.split(" ");
    parts = s2.split(" "); //Rewrites
    parts = s3.split(" "); //Rewrites
    for(String s4:parts) { 
      System.out.print(s4 + " ");
    }
The ouput of the program is obviously : Hello5 Hello6. (How to split a string in Java)
Regardless I expect the output Hello1 Hello2 Hello3 Hello4 Hello5 Hello6. Which is, the incoming string must not replace the existing Strings inside the array.
 
    