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));
    }/*from   ww  w.  j  a v  a2  s .co  m*/

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