I'm lost. My output display a, b, c new line a, b, c, d, e, f I played around with the join methods but still don't understand what i'm doing. Your help is appreciated.
package com.codegym.task.task16.task1629;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Solution {
public static volatile BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args) throws InterruptedException {
Read3Strings t1 = new Read3Strings();
Read3Strings t2 = new Read3Strings();
//write your code here
//write your code here
t1.start();
t1.join();
t2.start();
t1.printResult();
t2.join();
t2.printResult();
}
//write your code here
public static class Read3Strings extends Thread {
static ArrayList<String> list = new ArrayList<>();
@Override
public void run() {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
for (int i = 0; i<3; i++){
try {
list.add(reader.readLine());
list.add(" ");
} catch (IOException e) {
e.printStackTrace();
}
}
}
public void printResult(){
for (int i =0; i<list.size()-1; i++){
System.out.print(list.get(i));
}
System.out.println();
}
}
}