I am referencing Y. Daniel Liang's book "Introduction To Java Programming, Comprehensive Version, Ninth Edition" when I ask this question. Every time I see an object created by using a constructor, it goes something like this :
Car engine = new Car().
But in Daniel Liang's book, I found the following code (only the first 9 lines written here):
public class SimpleGeometricObject {
private String color = "white";
private boolean filled;
private java.util.Date dateCreated;
/** Construct a default geometric object */
public SimpleGeometricObject() {
dateCreated = new java.util.Date();
}
What I don't understand is how come the object "dateCreated" is not created in the normal way, ie.:
SimpleGeometricObject dateCreated = new SimpleGeometrciObject();
I'm confused.