Hi, I'm just learning to program and I'm stuck on a basic problem, printing today's date in a form typified by (e.g.) 28 February 2011

Java Syntax (Toggle Plain Text)

import java.util.*; 

    class Date 
    {
        int day, month, year;
    }

    class PrintToday 
    {
        static Date thisDay() 
        {
            Date today = new Date();
            GregorianCalendar c = new GregorianCalendar();  
            today.day = c.get(Calendar.DATE);
            today.month  = c.get(Calendar.MONTH)+1;
            today.year  = c.get(Calendar.YEAR);
            return today;
        }


        static String monthName(int m) 
        {
            if (m==1) return "January";
            else if (m==2) return "February";
            else if (m==3) return "March";
            else if (m==4) return "April";
            else if (m==5) return "May";
            else if (m==6) return "June";
            else if (m==7) return "July";
            else if (m==8) return "August";
            else if (m==9) return "September";
            else if (m==10) return "October";
            else if (m==11) return "November";
            else return "December";
        }

            public static void main(String[] args) 
        {       
               .......
        }
    }

I'm not sure how to implement these classes/methods in the main method.

You already have everything there. You need to initiate the class you implement, and then print its data out in order day, month, and year. You need to read Java tutorial for how to implement a simple class before you can go any further because your post shows that you understand NOTHING about Java...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.