Home > Back-end >  Java read a local file
Java read a local file

Time:12-27

 
Package cn. Itcast. Day15. Demo03;

Import the Java. IO. FileInputStream;
Import the Java. IO. IOException;

Public class Demo03InputStream {
Public static void main (String [] args) throws IOException {
FileInputStream fis=new FileInputStream (" day15 p-code \ \ which xt ");
int len=0;
While ((len=fis. Read ())!=1) {
System. The out. Print ((char), len);
}
Fis. Close ();
}
}

Why would a len variables, while not reinvent the wheel, cycle ((len=fis. Read ())!=1) why can't change to the while (fis) read ()!=1), I can't get the right result after changed,,,, what a great god understand to dispel doubts, thank you
  • Related