Skip to main content

it'sIt's also about the level of control over what is happening. If the declaration of an object/variable automatically calls a constructor e.g., for example, if

Person somePerson; 

was automatically the same as

Person somePerson = new Person(blah, blah..); 

then you'd never be able to use (for example) static factory methods to instantiate objects rather than default constructors i.e., that is, there are times when you don't want to call a constructor for a new object instance.

This example is explained in Bloch's "Effective Java"Joshua Bloch's Effective Java (Item 1 ironically enough!)

it's also about the level of control over what is happening. If the declaration of an object/variable automatically calls a constructor e.g. if

Person somePerson; 

was automatically the same as

Person somePerson = new Person(blah, blah..); 

then you'd never be able to use (for example) static factory methods to instantiate objects rather than default constructors i.e. there are times when you don't want to call a constructor for a new object instance.

This example is explained in Bloch's "Effective Java" (Item 1 ironically enough!)

It's also about the level of control over what is happening. If the declaration of an object/variable automatically calls a constructor, for example, if

Person somePerson; 

was automatically the same as

Person somePerson = new Person(blah, blah..); 

then you'd never be able to use (for example) static factory methods to instantiate objects rather than default constructors, that is, there are times when you don't want to call a constructor for a new object instance.

This example is explained in Joshua Bloch's Effective Java (Item 1 ironically enough!)

Source Link

it's also about the level of control over what is happening. If the declaration of an object/variable automatically calls a constructor e.g. if

Person somePerson; 

was automatically the same as

Person somePerson = new Person(blah, blah..); 

then you'd never be able to use (for example) static factory methods to instantiate objects rather than default constructors i.e. there are times when you don't want to call a constructor for a new object instance.

This example is explained in Bloch's "Effective Java" (Item 1 ironically enough!)