Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.*;
import java.util.Date;

public class Main {

    public static void main(String[] args) {
        Object obj1 = "Object";
        Object obj2 = 2;
        Date date = new Date();
        try {
            PrintWriter pw = new PrintWriter(System.out);

            // print object
            pw.print(obj1);

            // print another object
            pw.print(obj2);

            // print a date (it is an object)
            pw.print(date);

            pw.flush();

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