import java.io.*;
public class FileExample {
static FileInputStream fis;
public static void main(String[] args) {
try {
fis = new FileInputStream("example.txt");
int data;
while ((data = fis.read()) != -1) {
System.out.print((char) data);
}
fis.close();
} catch (IOException io) {
System.out.println("Caught IOException: " + io.getMessage());
}
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter