Ввожу к примеру
q
r
c
u
p
z
выведется :
u p z
u p z
======================================================================================================
Не пойму в чем проблема..
package com.javarush.task.task16.task1629;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
Только по-очереди!
*/
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();
t1.start();
t1.join();
t2.start();
t2.join();
t1.printResult();
t2.printResult();
}
public static class Read3Strings extends Thread{
static String s1;
static String s2;
static String s3;
@Override
public void run () {
try {
s1 = reader.readLine();
s2 = reader.readLine();
s3 = reader.readLine();
} catch (IOException e) {
e.printStackTrace();
}
}
public void printResult(){
System.out.print(s1 + " " + s2 + " "+ s3);
}
}
}