//传输对象: //读: InputStream ip=socket.getInputStream(); ObjectInputStream bb = new ObjectInputStream ( ip ); Person p= ( Person ) bb.readObject(); System.out.print ( p.name+p.number ); //写: Person p=new Person ( "wei",11 ); OutputStream op=socket.getOutputStream(); ObjectOutputStream oop=new ObjectOutputStream ( op ); oop.writeObject ( p );