Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.text.SimpleDateFormat;

public class Main {
    public static void main(String[] args) throws Exception {
        SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy");
        // Prints a value in 2014
        System.out.println(format.parse("16-16-2013"));
        format.setLenient(false);
        // Throws an exception
        System.out.println(format.parse("16-16-2013"));
    }
}