Which of the following keywords is used to create a new object in Java?

  • createObject
  • new
  • newInstance
  • newObject
In Java, the new keyword is used to create a new object. When you want to instantiate a class and create an object, you use the new keyword followed by the class constructor. For example, ClassName obj = new ClassName();. The other options are not used to create objects in Java.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *