this is what i have but when i run the program i get an error saying that i cant call a non-static method into a static method.
any advice on how i can fix this?
import java.util.GregorianCalendar;
import java.util.Calendar;
public class Main {
Calendar date = new GregorianCalendar();
public int getYear(){
int year = date.get(Calendar.YEAR);
return year;
}
public int getMonth(){
int month = date.get(Calendar.MONTH);
return month;
}
public int getDay(){
int day = date.get(Calendar.DAY_OF_MONTH);
return day;
}
public static void main(String[] args) {
System.out.println("Starting...");
System.out.println("Today's date is (yyyymmdd) " + getYear() + getMonth() + getDay() +".");
System.out.println("...Finished");
}
Edited by Dogstopper:

New Topic/Question
Reply
MultiQuote










|