I made a simple object that I'm trying to send though the OOS but everytime I try to send the class that I created it throws an IOException. But if I try to send objects through that I know are serializable it doesn't throw an error.
UserName userName = new UserName();
_out.write("Object is Made! \n");
serverOutput.writeObject(userName);
serverOutput.flush();
Here's the Username Code:
public class UserName implements Serializable {
private String _userName;
public UserName(String userName) {
_userName = userName;
}
public UserName(){
_userName = "John Doe";
}
/**
* @return the _userName
*/
public String get_userName() {
return _userName;
}
/**
* @param _userName the _userName to set
*/
public void set_userName(String userName) {
_userName = userName;
}
}
If I do this then it doesn't throw the error:
UserName userName = new UserName();
_out.write("Object is Made! \n");
serverOutput.writeObject(new String());
serverOutput.flush();
Do I actually have to implement any methods or am I forgetting something?