I'm trying to have the following output of the program:
But when I run the program I get :

How would I format the date to be like I want?

This is the code I have:

import java.util.Calendar;
import java.util.GregorianCalendar;

public class HelloWorld{

     public static void main(String []args){

        Calendar calendar = new GregorianCalendar();
        //set date to last day of 2009
        calendar.set(Calendar.YEAR, 2009);
        calendar.set(Calendar.MONTH, 11); // 11 = december
        calendar.set(Calendar.DAY_OF_MONTH, 31); // new years eve

        //add one day
        calendar.add(Calendar.DAY_OF_MONTH, 1);

        //date is now jan. 1st 2010
        int year       = calendar.get(Calendar.YEAR);  // now 2010
        int month      = calendar.get(Calendar.MONTH); // now 0 (Jan = 0)
        int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH); // now 1

        //System.out.println(month + "/" + dayOfMonth + "/" + year);


I know that if I change the format to


will give the output of "2010", but the 01/01 will not be shown.

Also, how would I make the program to execute a set of ten dates for example? I want to get the result of:

I will apreciate your help.

Calendar's getTime() method gives youa Date object representring the same date/time, which you can then format exactly as you like with a SimpleDateFormat - see the API docs for details

You can put Calendars in an array or an ArrayList (or any other Collection) to process multiple Calendars