java - Sending the same but modifed object over ObjectOutputStream -
i have following code shows either bug or misunderstanding on part. i sent same list, modified on objectoutputstream. once [0] , other [1]. when read it, [0] twice. think caused fact sending on same object , objectoutputstream must caching them somehow. is work should, or should file bug? import java.io.*; import java.net.*; import java.util.*; public class oos { public static void main(string[] args) throws exception { thread t1 = new thread(new runnable() { public void run() { try { serversocket ss = new serversocket(12344); socket s= ss.accept(); objectoutputstream oos = new objectoutputstream(s.getoutputstream()); list same = new arraylist(); same.add(0); oos.writeobject(same); same.clear(); same.add(1); oos.writeobject(same); } cat...