new Thread new Runnable public void run while true try if System in re

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
new Thread(new Runnable() {
public void run() {
while(true) {
try {
if(System.in.read() == 'q' || System.in.read() == 'Q' || System.in.read() == 'й' || System.in.read() == 'Й')
System.exit(0);
} catch(IOException io) {}
}
}
}).start();