Skip to Main Content

Different ways of creating objects?

c4bef551-b678-4eed-950e-318f21a47a28Apr 29 2018 — edited Apr 30 2018

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,


Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked due to inactivity on May 28 2018
Added on Apr 29 2018