+ 1

What are temporary inntances? What is their use in java?

2nd Jul 2017, 3:57 PM
Mohit Rai
Mohit Rai - avatar
3 Antworten
+ 4
@Suhail, I never heard of anonymous object. maybe you're talking about anonymous class whose instance is created when required. Anonymous class is used when you don't need a whole object to be created and allocate it's own space permanantly but for a single step.
2nd Jul 2017, 4:16 PM
Sachin Artani
Sachin Artani - avatar
0
Temporary instance of a class in java is an anonymous object of that perticular class and i guess this can be used to invoke a method well anyone can correct me if i am wrong
2nd Jul 2017, 4:13 PM
Suhail Pappu
Suhail Pappu - avatar
0
Temporary instances, as the name suggests, are temporary objects. They are allocated the system memory as long as the code requires it and then the memory is freed up to heap memory.
3rd Oct 2018, 3:20 PM
Arpit Khandelwal
Arpit Khandelwal - avatar