@@ -0,0 +1,270 @@
+// Read input until a q is received.%0Aclass Break2 %7B%0A%09public static void main(String args%5B%5D) throws java.io.IOException %7B%0A%09%09char ch;%0A%09%09%0A%09%09for( ; ; ) %7B%0A%09%09%09ch = (char) System.in.read(); // get a char%0A%09%09%09if(ch == 'q') break;%0A%09%09%7D%0A%09%09System.out.println(%22You pressed q!%22);%0A%09%7D%0A%7D%0A

Use break to exit infinite loop