Calendar now = Calendar.getInstance()
Does this create an object called now? Normally you have to use the new statement to create an object. I'm confused
Printable View
Calendar now = Calendar.getInstance()
Does this create an object called now? Normally you have to use the new statement to create an object. I'm confused
Yup. Creates a Calendar with the current date plugged into it, or in computery terms,
Initialises a calendar object too the current date/time as described by the current system time.
Thanks. I'm really new to Java and find it very interesting. I googled this topic and found what I was looking for. The Calendar.getInstance() returns a calendar object and Initialize it with the current system time.
Its just that I'm under the impression that you have to use the new statement to create an object but then again I know you use new to call a constructor method of a class.
So looking up the Calendar class in the Java API and reading what the getInstance method does never entered your mind?