public static void main(String[] args) throws IOException { // read count of strings int count = Integer.parseInt(reader.readLine()); // init threads ReaderThread consolReader1 = new ReaderThread(); ReaderThread consolReader2 = new ReaderThread(); ReaderThread consolReader3 = new ReaderThread(); while (count > countReadStrings) {} consolReader1.interrupt(); consolReader2.interrupt(); consolReader3.interrupt(); System.out.println("#1:" + consolReader1); System.out.println("#2:" + consolReader2); System.out.println("#3:" + consolReader3); reader.close(); }