public void run(){ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); while(true){ try{ System.out.print(commando); System.out.flush(); String line = in.readLine(); tal = Integer.parseInt(line); System.out.println("The entered number was OK"); if(line.equals("stop")) break; }catch(Exception e){ System.out.println(e); } System.out.println("Nice talking to you!"); System.exit(0); } }