import java.io.FileInputStream;
import java.io.IOException;
public class Main {
public static void main(String[] args) {
// "try-with-resources": the stream will be closed automatically
try (FileInputStream input = new FileInputStream("filename.txt")) {
int i;
while ((i = input.read()) != -1) {
System.out.print((char) i);
}
} catch (IOException e) {
System.out.println("Error reading file.");
}
}
}