Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.*;

public class Main {

    public static void main(String[] args) {

        String s = "from java2s.com";

        StringReader sr = new StringReader(s);

        PushbackReader pr = new PushbackReader(sr, 20);

        char cbuf[] = new char[5];

        try {
            System.out.println(pr.read(cbuf));

            System.out.println(cbuf);

            pr.close();

        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
}