社区
Java SE
帖子详情
对象怎样序列化呀!!急急!!
chenhagi_0
2004-11-21 08:10:55
我想问大哥,大姐一个问题,怎样实现对象的序列化!能不能给个例子,谢了!!分高哟
...全文
159
7
打赏
收藏
对象怎样序列化呀!!急急!!
我想问大哥,大姐一个问题,怎样实现对象的序列化!能不能给个例子,谢了!!分高哟
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用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存储到内存中,其它外部程序可以读取后在使用统一的配置文件,可是 wcf在保存的时候报错,说是
序列化
报错。咋办咋办????谢谢。 var path = HttpContext.Current.Server.MapPath("~/Config/dbcfg/" + item
急急
如律令!火速搭建一个C#即时通信系统!(附源码分享——高度可移植!)...
(2016年3月更:由于后来了解到GGTalk开源即时通讯系统,因此直接采用了该资源用于项目开发,在此对作者表示由衷的感谢!) —————————————————————————————————— 人在外包公司,身不由己!各种杂七杂八的项目都要做,又没有自己的技术沉淀,每次涉足新的项目都倍感吃力,常常现学现卖,却不免处处碰壁!当然,话说回来,也是自己的水平有限在先...
Leetcode 剑指 Offer II 048. 二叉树的
序列化
与反
序列化
本题首先看上去像是一个贪心问题,对于齐王的马从大到小进行排序,然后对于齐王的马来说如果田的马没有比齐王马好的,那么就使用田最弱的马和他去比。所以,在面试前一天,哪怕是临时抱佛脚,也要。目前有两个offer比较纠结,一个航天科工三级单位,刚成立没几年的,担心待遇和发展空间不好另一个特变电工,担心平台小,以后裁员不好找工作有没有已经在里面的学长学。RT,面某公司时,他说,你这项目在我们看来就是个demo,不可能获奖啊我尬笑说,确实功能都比较基础,可能我们参赛文档写的好吧,而且花了一周写完的他说,实话告诉你。
怎样操作数据库的Blob字段将文件写入数据库!!!
怎样操作数据库的Blob字段将文件写入数据库!!!
急急
急!!!请高手指教!!! 回复人: weimenren(愚人码头) ( ) 信誉:152 2004-7-13 20:23:07 得分: 45 希望下面的可以解决你的问题 http://otn...
[转贴]Java中操作数据库的Blob字段,将文件写入数据库!!!
怎样操作数据库的Blob字段将文件写入数据库!!!
急急
急!!!请高手指教!!! --------------------------------------------------------------- 希望下面的可以解决你的问题 http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/files/advanced/LOBSam
Java SE
62,634
社区成员
307,269
社区内容
发帖
与我相关
我的任务
Java SE
Java 2 Standard Edition
复制链接
扫一扫
分享
社区描述
Java 2 Standard Edition
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章