Here is a sample program as an Example for Buffered reader, I got most of it and understood the fact that the while loop execution stop when (br.read()=-1)
but couldn't understand why is that so?
import java.io.*;
public class BufferedReaderExample {
public static void main(String args[])throws Exception{
FileReader fr=new FileReader("D:\\testout.txt");
BufferedReader br=new BufferedReader(fr);
int i;
while((i=br.read())!=-1) //<<<<I'm talking about this here
{
System.out.print((char)i);
}
br.close();
fr.close();
}
}