returning a Date from a method
in class we have a lab that uses a method to return a Date.
The Date is printed out to the console when the driver class calls it. I tried using dateCreated.getDate() but it says it cannot convert from int to Date.
here is some snippets from my code
private Date dateCreated;
protected Date getDateCreated()
{
return dateCreated;
}//this method does nothing yet (returns Null)
any suggestions?
thanks!
So what's you question again?
I see nothing wrong with the code given.
The getDate method of java.util.Date returns the day of the month (an int value) represented by the Date object, however this method has been deprecated since JDK 1.1.
dwga at 2007-7-29 16:18:03 >

I want the date to be displayed upon the driver class calling it.
Currently, when the driver class calls the method getDateCreated()
it returns a null to System.out.println
I don't want a null I want the date
if this is still unclear please let me know I awill post more code in hopes that it will be more clear on what I am trying to do.
Thanks!
private Date dateCreated = new Date();
Or did you want to add a set method?
void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
Remember: data doesn't magically appear from nowhere!