When is the object created with the new keyword?

Java MCQ: When is the object created with the new keyword?

a) At runtime
b) At compile-time
c) Depends on the code
d) None of the above

Answer:

a) At runtime

Explanation:

In Java, objects are created at runtime when the new keyword is used. This is when memory is allocated for the new object, and the constructor is called.

Reference links:

https://www.rameshfadatare.com/learn-java-programming/
https://www.javaguides.net/p/java-tutorial-learn-java-programming.html

Leave a Comment

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

Scroll to Top