在做字符流读 取时 
 
import java.io.*; 
public class CharStream  
{ 
      public static void main(String[] args) throws IOException 
      { 
             FileReader fr = new FileReader("c://demo.txt"); 
 
              //读取的字符数,如果已到达流的末尾,则返回 -1 
              while(true) 
             { 
               //用这样的方式输出有误 
                 sop(fr.read()); 
                 if(fr.read()== -1) 
                  break; 
   
              //用这样的方式输出正确 
                /* 
                int ch = fr.read(); 
                if(ch==-1) 
                break; 
                sop(ch); 
                */ 
             } 
        } 
     public static void sop(Object o) 
     { 
              System.out.println(o); 
        } 
} 
 
自我感觉,这两个判断语句要表达的意思一样,为什么得到的结果会不同呢? 
 |   
        
 
    
    
    
     
 
 |