import java.io.IOException;import java.io.InputStreamReader;import java.io.BufferedReader;public class ConsoleTest{ public ConsoleTest(){ MyConsoleAdapter adapter = new MyConsoleAdapter(); } public static void main(String[] args){ new ConsoleTest(); }}class MyConsoleAdapter extends ConsoleAdapter{ public void lineTyped(String line){ System.out.println("recieved line='" + line + "'"); }}abstract class ConsoleAdapter extends Thread{ private BufferedReader consoleIn; public ConsoleAdapter(){ this.consoleIn = new BufferedReader(new InputStreamReader(System.in)); this.start(); } public void run(){ while(true){ try{ lineTyped(consoleIn.readLine()); }catch(java.io.IOException ioe){ ioe.printStackTrace(); } } } public abstract void lineTyped(String line);}