try {
FileInputStream fis = new FileInputStream("d:/a.txt"); //内容是:abc
int s1 = fis.read(); //97
int s2 = fis.read(); //98
int s3 = fis.read(); //99
int s4 = fis.read(); //-1
int s5 = fis.read(); //-1
System.out.println(s1);
fis.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
|
|