FileInputStream filepath= new FileInputStream(path+ "/" + file);
BufferedReader br= new BufferedReader(new InputStreamReader(filepath));
StringBuffer stringbuffer= new StringBuffer();
String strLine;
//Assuming there is some file with some data in it
while((strLine = br.readLine())!=null)
{
stringbuffer.append(strLine);
stringbuffer.append("\f");
}
最后strLine的值是null还是readline获得的数据?
答案 0 :(得分:1)
strLine
值将为null,因为此条件会破坏while循环。
答案 1 :(得分:1)
它只能为null,因为这是循环停止的唯一条件。