Java FileInputStream.close()
Syntax
FileInputStream.close() has the following syntax.
public void close() throws IOException
Example
In the following code shows how to use FileInputStream.close() method.
/*from w w w . jav a 2 s .c om*/
import java.io.IOException;
import java.io.FileInputStream;
public class Main {
public static void main(String[] args) throws IOException {
FileInputStream fis = new FileInputStream("C://test.txt");
int i = fis.read();
char c = (char) i;
System.out.println(c);
// close file input stream
fis.close();
}
}
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »