public static void main(String[] args) throws IOException {
new File("xxx.txt").createNewFile();
FileInputStream fs = new FileInputStream("xxx.txt");
int b;
while ((b = fs.read()) != -1) { //为什么这步必须要赋值给int,不赋值直接用fs.read()会少打几个字母,例如在txt文件里放abcdf字母
System.out.println(b);
}
fs.close();
}
|
|