Results 1 to 4 of 4
  1. #1
    volkvanmyn25 is offline Member
    Join Date
    Oct 2011
    Posts
    5
    Rep Power
    0

    Default Calendar now = Calendar.getInstance()

    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

  2. #2
    christopherx is offline Member
    Join Date
    Oct 2011
    Posts
    92
    Rep Power
    0

    Default Re: Calendar now = Calendar.getInstance()

    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.

  3. #3
    volkvanmyn25 is offline Member
    Join Date
    Oct 2011
    Posts
    5
    Rep Power
    0

    Default Re: Calendar now = Calendar.getInstance()

    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.

  4. #4
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,755
    Rep Power
    7

    Default Re: Calendar now = Calendar.getInstance()

    So looking up the Calendar class in the Java API and reading what the getInstance method does never entered your mind?

Similar Threads

  1. Replies: 4
    Last Post: 09-21-2011, 04:39 PM
  2. Calendar Help Please
    By loopsnhoops in forum New To Java
    Replies: 4
    Last Post: 05-24-2011, 10:35 AM
  3. How to add a calendar????
    By zifis in forum New To Java
    Replies: 5
    Last Post: 04-07-2009, 04:04 PM
  4. Calendar bug?
    By Stigvig in forum Advanced Java
    Replies: 14
    Last Post: 02-08-2009, 09:56 AM
  5. calendar
    By John in forum SWT / JFace
    Replies: 12
    Last Post: 08-07-2008, 10:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •