FileReader输入流和InputStreamReader输入流的区别
import java.util.*;
import java.io.*;
public class  OutputExa  
{
  public static void main(String args[])
  { int a,b,c;
    try
    {  
      BufferedReader din=new BufferedReader(new InputStreamReader(System.in));
      a=Integer.parseInt(din.readLine());//1
      b=Integer.parseInt(din.readLine());//2
      c=Integer.parseInt(din.readLine());//3
      int t;
      if(a>b)
       { t=a;a=b;b=t;
       }
      if(a>c)
      {
       t=a;a=c;c=t;
       }
      if(b>c)
      {
       t=b;b=c;c=t;
      }
     System.out.println("a="+a+",b="+b+",c="+c);
    }
    catch(
IOException e){}
  }
}
上面是从键盘输入三个数比较大小,FileReader和InputStreamReader都是字符流,为什么代码中的InputStreamReader(System.in)不能用FileReader(System.in)替换?当用键盘输入第一个数字//1处运行,输入到第三个数字时//3处下面的运行,这个是什么道理???
------解决方案--------------------
FileReader:需要从文件中读取数据时用。
InputStreamReader:需要从键盘接收数据时用。通常是按字符流读入时,一般也不仅从键盘,也可以文件,网络,其它对象中读取,不过是按字符进行读取。它是Reader的直接子类
更详细的得看JDK