//输入流的初始练习 import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; //输入流练习 public class FirstDemo { public static void main(String[] args) throws IOException { //创建字节输入流对象 FileInputStream fis=null; try { fis=new FileInputStream("d:/a.txt"); int s1=fis.read(); System.out.println(s1); int s2=fis.read(); System.out.println(s2); int s3=fis.read(); System.out.println(s3); int s4=fis.read(); System.out.println(s4); } catch (FileNotFoundException e) { e.printStackTrace(); }finally { try { fis.close(); } catch (IOException e) { e.printStackTrace(); } } } }