stop the loop when enter nothing
Posted on 2001-06-18
hai, i just need to implement a loop that can be stop when i enter "nothing"
by using the following incorrect statement:
BufferedReader br=new BufferedReader(new InputStreamReader (System.in));
System.out.print("Enter any string: ");
//this loop is working wrongly,it doesn't stop!
output suppose to be like below:
Enter any string: abc
Enter any string: cds
Enter any string:
//when nothing(empty string) is being enter, the loop stop.
how the above coding can be modified?