Prabhat Ranjan wrote:My answer is below one.
1) New()
Please comments any one who is expert and used fully.
Campbell Ritchie wrote:I can think of four more ways. Or maybe they are 3½ ways.
Campbell Ritchie wrote:No, 4½.
5½Chan Ag wrote: . . .
Interesting. One of them, I think, is the enum(s)? Thinking about the other three and a half ways now .. :-)
. . .
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Ulf Dittmer wrote:... As to the answer, all options but #4 are highly likely to be identical, namely, calling the no-argument constructor. ...
fred rosenberger wrote:Doesn't it depend on what you mean by 'create an instance'? for example, de-serializing an object implies the object has already been created. It's like a balloon that has been deflated. Blowing it up doesn't "create" a balloon, does it? Or perhaps a better example is a piece of sheet music. Does the song exist when it's just written down, or does it only exist when it is being performed?
What's brown and sticky? ... a stick. Or a tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|