Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Date;

public class Main {

    public static void main(String[] args) {

        Date date = new Date();
        Date date2 = new Date();

        // make 3 comparisons with them
        int comparison = date.compareTo(date2);
        int comparison2 = date2.compareTo(date);
        int comparison3 = date.compareTo(date);

        // print the results
        System.out.println("Comparison Result:" + comparison);
        System.out.println("Comparison2 Result:" + comparison2);
        System.out.println("Comparison3 Result:" + comparison3);

    }
}