Wednesday, December 11, 2019

Different Ways to Create Objects in Java


Using the new keyword
The constructor gets called
Using newInstance() method of Class class
The constructor gets called
Using newInstance() method of Constructor class
The constructor gets called
Using clone() method
No constructor call
Using deserialization
No constructor call


Ref: https://dzone.com/articles/5-different-ways-to-create-objects-in-java-with-ex

No comments:

Post a Comment