Hi ..
This IO program is getting compiled without any error.
But I couldn't run it.
Here it is:-
import java.io.*;
class inpu2{
public static void main(
String args[]){
BufferedReader rb = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out,true);
String str="rahul";
pw.println("enter lines to write." + "enter 'stop' to quit");
try{
while(!str.equals("stop"));
{
str = rb.readLine();
pw.println(str);
}
}catch(IOException e){pw.println ("kaya he?");}
}
}
I think its getting in to infinite loop .but why?
When I done it using do-while loop it ran properly .
But why not this way?
Plz help.
rahul