go to previous page   go to home page   go to next page

Answer:

Yes. The Java text and util packages have classes DateFormat, Calendar, and Date which have many features for dealing with dates and times.


String to MyDate

But let us ignore that and write our own class, MyDate. This example shows how to create an object based on an input string. Here is our complete MyDate class:

class MyDate
{
  int day, month, year;

  MyDate ( int d, int m, int y )
  {
    day = d; month = m; year = y;
  }

  public String toString()
  {
    return day + "/" + month + "/" + year ;
  }
}

QUESTION 13:

Does this class have "getter" and "setter" methods?