Computer Science, asked by 19052, 1 year ago

How can objects be initialized with desired values at the time of object creation

Answers

Answered by Cutie1111
3
An object is a chunk of memory bundled with the code that manipulates memory. In the memory, the object maintains its state (the values of its instance variables), which can change and evolve throughout its lifetime. To get a newly-created object off to a good start, its newly-allocated memory must be initialized to a proper initial state. This article is a companion piece to this month's Design Techniques installment, which focuses on designing classes for proper initialization. Here we take an in-depth look at the mechanisms Java uses to manage object initialization.
Answered by karthik4297
13
You can initialize an object with some value at the time of object creation by passing the values in the Constructor.

19052: Thanks
Similar questions