package one;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Vector;
public class VectorTest {
public static void main(String[] args) throws Exception {
Vector<Student> vector = new Vector<Student>();
vector.add(new Student());
vector.add(new Student());
vector.add(new Student());
vector.add(new Student());
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(
"test"));
out.writeObject(vector);
}
}
class Student implements Serializable {
private static final long serialVersionUID = -135535857245815748L;
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Make sure that Student is Serializable and instead of FileOutputStream make it outputstream of socket. In the server side make sure it recieves the inputstream as ObjectInputStream..
Hope it helps ..