Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class Main {
    public void readOneByte() throws FileNotFoundException {
        FileInputStream file = null;
        byte x = -1;
        try {
            file = new FileInputStream("fileName");
            x = (byte) file.read();
        } catch (FileNotFoundException f) {
            throw f;
        } catch (IOException i) {
            i.printStackTrace();
        } finally {
            try {
                if (file != null) {
                    file.close();
                }
            } catch (IOException e) {
            }
        }
    }
}