private Object readResolve(){
return ourInstance;
}
And
private Singlton readResolve(){
return ourInstance;
}
when i used Singlton as return type it is giving different value for singleton1 and singleton for bellow code
Singleton singleton = deserializeSingletonInstance(byteArrayOutputStream);
Singleton singleton1 = deserializeSingletonInstance(byteArrayOutputStream);
Please help me to understand the different between returning object and Singlton
Under discussion
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Angus McDonaldExpert
23 June 2020, 08:54
This Stackoverflow post helped me solve it.
https://stackoverflow.com/questions/21361137/deserializing-a-singleton-in-java
+2
Prassha
24 June 2020, 10:23
Thank you.
0