In one of the java interview, the following question is asked:
In java is there a way to instantiate an object without using new
operator? I replied to him that there is no other way of instantiation. But he asked me how an object in java is instantiated with the configurations in an xml
file in java(in spring framework). I said, internally the spring uses reflection utils
to create an object with a new
operator. But the interviewer was not convinced with my answer.
I saw this link to be useful but there is a new
operator indirectly involved in one or the other internal methods.
Is there really a way to instantiate objects in java without using new
operator?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…