Java - Write code to format Date as dd/MM/yyyy

Requirements

Write code to format Date as dd/MM/yyyy

Demo

//package com.book2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static void main(String[] argv) {
        Date date = new Date();
        System.out.println(formatDate(date));
    }/* w w  w. j  a va 2s .  co  m*/

    public static final String formatDate(Date date) {
        return new SimpleDateFormat("dd/MM/yyyy").format(date);
    }
}