import java.io.*;
public class TerminateWhen
{
public static void main(String args[]) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str = "";
System.out.println("Type \"x\" to exit..");
do {
str = br.readLine();
System.out.println(str);
}
while(str!="x");
}
}
the problem is even if will type the "x", the loop will not exit..