-
Notifications
You must be signed in to change notification settings - Fork 862
Open
Description
Hi,
How are you Sir?
So there is a problem in Exercise_09_05 , because you have accessed a Static Field using an instance reference
System.out.println(calender.get(calender.MONTH) + "/" +
calender.get(calender.DAY_OF_MONTH) + "/" + calender.get(calender.YEAR));
The correct way to access a static field, would be through the class name, like the following:
Instantiate a new object:
GregorianCalendar calendar = new GregorianCalendar();
and then access the static field using the GregorianCalendar class itself.
System.out.println(calendar.get(GregorianCalendar.MONTH) + "/" +
calendar.get(GregorianCalendar.DAY_OF_MONTH) +
"/" + calendar.get(GregorianCalendar.YEAR));
Thanks a lot.
Metadata
Metadata
Assignees
Labels
No labels