2 Replies Latest reply on May 1, 2018 1:05 AM by morgalr

    Different ways of creating objects?


      Hi All,


      I am new to Java and am studying a text book on the subject.


      I have come across the following two lines of code; each of which creates a new object -


      Calendar cal = Calendar.getInstance();


      Date now = new Date();


      I have a reasonable understanding of the 'new' keyword, and it's relationship to creating objects.


      However I am wondering if anybody can explain to me, or point me in the direction of a good resource, which thoroughly explains why some objects are created with dot(.) notation, e.g.: Calendar.getInstance();, and others are created with the 'new' keyword? I am anticipating that the difference will relate to 'System' classes, but I have no idea of what these actually are!


      Any help here would be greatly appreciated.


      Kind Regards,