清晰度与此代码的输出

时间:2014-12-25 14:43:43

标签: java file-io

 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获得的数据?

2 个答案:

答案 0 :(得分:1)

strLine值将为null,因为此条件会破坏while循环。

答案 1 :(得分:1)

它只能为null,因为这是循环停止的唯一条件。