Advertisements
Advertisements
Question
when is a constructor invoked?
Short Answer
Short Note
Solution
- A constructor is invoked as soon as the object is created to initialize the object.
- E.g., Car hybrid = new Car();
- In the above example, Car() is invoking a default constructor.
shaalaa.com
Is there an error in this question or solution?