Q. Which of the following ways is the correct way to create an object in Java?
β
Correct Answer: (D)
All of these
Explanation: All of the above-mentioned ways are the correct way to create an object Java.
There are five different ways to create an object and we will see the ways to create an object given below:
Using the new keyword
Using newInstance() method of Class
Using clone() method
Using newInstance() method of Constructor class
Using deserialization