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 = "tutorial from java2s.com";
        try {

            PrintWriter pw = new PrintWriter(System.out);

            // write substrings
            pw.write(s, 0, 5);
            pw.write(s, 6, 5);

            // flush the writer
            pw.flush();

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