Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.FileInputStream;
import java.io.InputStream;

public class Main {
    public static void main(String[] args) throws Exception {

        // new input stream created
        InputStream is = new FileInputStream("C://test.txt");

        // invoke available
        int i = is.available();

        // number of bytes available is printed
        System.out.println(i);

        // releases any system resources associated with the stream
        is.close();

        // throws io exception on available() invocation
        i = is.available();
        System.out.println(i);

    }
}