package chat; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class KeyboardThread extends Thread { private Queue q; public KeyboardThread(Queue q) { this.q = q; } public void run() { BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in)); while(true) { try { q.put(inFromUser.readLine()); } catch (IOException e) { e.printStackTrace(); } } } }