Hey guys,
my second java problem in 24 hours :)
I'm trying to call a method from another class. So basically what i'm trying to do is put the date from the main class through the method "tomorrow" so it adds 1 to the int day and returns the date to the main. I've been stuck on this for hours and have tried messing around with it but to no avail. I've highlighted my problem in bold. Thanks in advance guys.
class newDate {
public newDate() {
day = 1;
month = 1;
year = 1970;
}
public newDate(int _day, int _month, int _year) {
day = _day;
month = _month;
year = _year;
}
int day;
int month;
int year;
[B]public newDate tomorrow(Date futureDate) {
futureDate.day++;// i'm adding one day on to the int day in the futureDate object.
return this;[/B]
}
}
class newTomorrow {
public static void main(String[] args){
[B]newDate rob = new newDate(20,10,2010);
rob.tomorrow();
System.out.println("The new date is " + rob.tomorrow());[/B]
}
}