I've been trying to build a java program to display the date in a MM/DD/YYYY format with constructors to link the return data, this is the initial sequence and was wondering about my get and set statement; and their format.

// Date class with a constructor to
// to initialize instance variable to display date.
import java.util.Scanner;

public class Date 
    private int month; // instance variable that stores the month variable
    private int day;// instance variable that stores the day variable
    private int year;// instance variable that stores the year variable

   // constructor displays date in MM/DD/YYYY format   
    public Date(int date) 
        date = displayDate; 
   } // end Date constructor
   // method  to set the date
   public void setMonth(int Month variable)
    month = Month variable;
    public void setDay(int Day variable)
    day = Day variable;
    public void setYear(int Year variable)
    year = Year variable;
    //end method setDate

        //method to retrieve Date
            public int getMonth()
        return month;
    public int getDay()
        return day;
    public int getYear()
        return year;
    // end method getDate

    //display Date
    public void displayDate (date)

    }//end class Date


Edited 3 Years Ago by Reverend Jim: Fixed formatting

Good jCoke,

System.out.println(mm + "/" + dd + "/" + yy);

I have worked out most of the bugs, but I keep getting a expected error with the following statement:


This article has been dead for over six months. Start a new discussion instead.