Bird
0
0

What happens immediately after an object is created using the new keyword in Java?

easy📝 Conceptual Q1 of 15
Java - Classes and Objects
What happens immediately after an object is created using the new keyword in Java?
AThe constructor of the class is called to initialize the object
BThe object is automatically destroyed
CThe object is copied to another memory location
DThe object becomes a static variable
Step-by-Step Solution
Solution:
  1. Step 1: Understand object creation with new

    When new is used, Java allocates memory for the object.
  2. Step 2: Constructor call after memory allocation

    Immediately after memory allocation, the constructor runs to initialize the object.
  3. Final Answer:

    The constructor of the class is called to initialize the object -> Option A
  4. Quick Check:

    Object creation calls constructor = B [OK]
Quick Trick: Object creation always triggers constructor call [OK]
Common Mistakes:
  • Thinking object is destroyed right after creation
  • Confusing object creation with copying
  • Assuming object becomes static automatically

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Java Quizzes