public class TestMySource {
public static void main(String args[])
throws java.io.IOException{
char ch;
for (;;) {
System.out.print("Please insert a char: ");
ch = (char) System.in.read();
if (ch == '.') {
break;
}
}
}
}
output: Please insert a char: Please insert a char: Please insert a char: a
Please insert a char: Please insert a char: Please insert a char: s
I can't explain why print "Please insert a char:" 3 times and then i can insert a char?