社区
Java SE
帖子详情
对象怎样序列化呀!!急急!!
chenhagi_0
2004-11-21 08:10:55
我想问大哥,大姐一个问题,怎样实现对象的序列化!能不能给个例子,谢了!!分高哟
...全文
135
7
打赏
收藏
对象怎样序列化呀!!急急!!
我想问大哥,大姐一个问题,怎样实现对象的序列化!能不能给个例子,谢了!!分高哟
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
7 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
beakham
2004-11-22
打赏
举报
回复
实现Serializable
classjava
2004-11-21
打赏
举报
回复
import java.io.Serializable;
public class Test implements Serializable()
{ int i=0;
public static void main(String[] args)
{ new Test();
}
}
这就是啦
JaredJared
2004-11-21
打赏
举报
回复
import java.io.Serializable;
public class Player implements Serializable {
private int id;
private String nick;
private String password;
private String gender;
private String email;
private int score = 0;
private int grade = 0;
private int totalAmount = 0;
private String regDate;
public Player() {}
public Player(int id, String pass) {
this.id = id;
this.password = pass;
}
public Player(String name, String pass, String gender, String email) {
this.nick = name;
this.gender = gender;
this.password = pass;
this.email = email;
}
public Player(int id, String name, String pass, String gender, String email, int s, int g, int t, String r) {
this(name, pass, gender, email);
this.id = id;
this.score = s;
this.grade = g;
this.totalAmount = t;
this.regDate = r;
}
public Player(Player player) {
this.id = player.id;
this.nick = new String(player.nick);
this.password = new String(player.password);
this.gender = new String(player.gender);
this.email = new String(player.email);
this.score = player.score;
this.grade = player.grade;
this.totalAmount = player.totalAmount;
this.regDate = new String(player.regDate);
}
public String toString() {
String str;
str = "用户帐号: " + id;
str += "\n昵称: " + nick;
str += "\n密码:" + "******";
str += "\n性别:" + gender;
str += "\nE-mail:" + email;
str += "\n积分:" + score + " 等级:" + grade + " 对弈场数:" + totalAmount;
str += "\n注册日期:" + regDate;
return str;
}
public String getEmail() {
return email;
}
public int getGrade() {
return grade;
}
public String getGender() {
return gender;
}
public int getId() {
return id;
}
public int getTotalAmount() {
return totalAmount;
}
public String getNick() {
return nick;
}
public String getPassword() {
return password;
}
public int getScore() {
return score;
}
public void setEmail(String string) {
email = string;
}
public void setGrade(int i) {
grade = i;
}
public void setGender(String string) {
gender = string;
}
public void setId(int i) {
id = i;
}
public void setTotalAmount(int i) {
totalAmount = i;
}
public void setNick(String string) {
nick = string;
}
public void setPassword(String string) {
password = string;
}
public void setScore(int i) {
score = i;
}
public String getRegDate() {
return regDate;
}
}
funcreal
2004-11-21
打赏
举报
回复
实现Serializable即可。这个接口没有任何方法。
jFresH_MaN
2004-11-21
打赏
举报
回复
class test implements java.io.Serializable{
//......
}
JaredJared
2004-11-21
打赏
举报
回复
实现Serializable 接口就可以了!
sjg008
2004-11-21
打赏
举报
回复
帮你顶一下
急急
急急
急急
我通过程序把nhibernate的配置文件读取到configuration这个Nhibernate的...wcf在保存的时候报错,说是
序列化
报错。咋办咋办????谢谢。 var path = HttpContext.Current.Server.MapPath("~/Config/dbcfg/" + item
matlab 股票分时图_matlab画股票走势图
急急
急!
在MATLAB命令行窗口输入help candle,查看该函数的使用格式,具体如下:>> help candlecandle Candlestick chart.candle(HI, LO, CL, OP)candle(HI, LO, CL, OP, COLOR, DATES, DATEFORM)Optional Inputs: ...
Leetcode 剑指 Offer II 048. 二叉树的
序列化
与反
序列化
二叉树的
序列化
与反
序列化
题目难度: 困难原题链接今天继续更新 Leetcode 的剑指 Offer(专项突击版)系列, 大家在公众号 算法精选 里回复 剑指offer2 就能看到该系列 亚控到底怎样?值得去吗? 本人没去过亚控的...
怎样操作数据库的Blob字段将文件写入数据库!!!
怎样操作数据库的Blob字段将文件写入数据库!!!
急急
急!!!请高手指教!!! 回复人: weimenren(愚人码头) ( ) 信誉:152 2004-7-13 20:23:07 得分: 45 希望下面的...
[转贴]Java中操作数据库的Blob字段,将文件写入数据库!!!
怎样操作数据库的Blob字段将文件写入数据库!!!
急急
急!!!请高手指教!!! --------------------------------------------------------------- 希望下面的可以解决你的问题 ...
Java SE
62,614
社区成员
307,326
社区内容
发帖
与我相关
我的任务
Java SE
Java 2 Standard Edition
复制链接
扫一扫
分享
社区描述
Java 2 Standard Edition
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章