import java.io.*; public class RunActive { public static void main(String[] args) { ActiveObject it=new ActiveObject(); BufferedReader input=new BufferedReader(new InputStreamReader(System.in)); System.out.println("[main starting]"); it.start(); while (true) { String s=""; try { Thread.sleep(1); } catch (InterruptedException e) { } while (it.responseready()) { String r=it.getresponse(); System.out.println("Response was \""+r+"\""); } try { if (input.ready()) s=input.readLine(); } catch (IOException e) { break; } if (!s.equals("")) { it.sendmessage(s); if (s.equals("stop")) break; } } System.out.println("[main done]"); } }