Home »
MCQs »
Java MCQs
Which of the following ways is the correct way to create an object in Java?
64. Which of the following ways is the correct way to create an object in Java?
- Using the new keyword
- Using newInstance() method
- clone() method
- All of these
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
Read more: Different ways to create an object in Java