Five Different Ways to Create Objects in Java
a thread...
1. Using a new keyword.
It's the most popular one. We create an object by using a new operator followed by a constructor call.
Eg:
2. Using the newInstance() method of class "Class":
Eg:
3️. Using the newInstance() method in class "Constructor":
Eg:
Note:
Both the above ways (Shown in 2 and 3),
are known as reflective ways of creating objects.
Fun-fact:
Class's newInstance() method internally uses Constructor's newInstance() method.