标签:system string dem class tst rgs demo exception str
1 public class Demo1_FileInputStream { 2 3 public static void main(String[] args) throws IOException { 4 //demo1(); 5 FileInputStream fis = new FileInputStream("a.txt"); // 内容为 abc 6 int x; 7 while((x = fis.read())!=-1) { 8 System.out.println(x); 9 } 10 } 11 12 public static void demo1() throws FileNotFoundException, IOException { 13 FileInputStream fis = new FileInputStream("a.txt"); // 内容为 abc 14 int x = fis.read(); // x = 97 15 System.out.println(x); // 当 文件中的内容读完后再读时 返回值为 -1 16 fis.close(); 17 } 18 19 }
标签:system string dem class tst rgs demo exception str
原文地址:https://www.cnblogs.com/jiangjunwei/p/9286373.html