当前位置: 技术问答>java相关
初学者:::救救我,什么是Serializable
来源: 互联网 发布时间:2017-03-28
本文导语: 救救我,什么是Serializable,感谢能举个例子 | import java.io.*; class tree implements java.io.Serializable { public tree left; public tree right; public int id; public int level; priv...
救救我,什么是Serializable,感谢能举个例子
|
import java.io.*;
class tree implements java.io.Serializable {
public tree left;
public tree right;
public int id;
public int level;
private static int count = 0;
public tree(int depth) {
id = count++;
level = depth;
if (depth > 0) {
left = new tree(depth-1);
right = new tree(depth-1);
}
}
public void print(int levels) {
for (int i = 0; i
class tree implements java.io.Serializable {
public tree left;
public tree right;
public int id;
public int level;
private static int count = 0;
public tree(int depth) {
id = count++;
level = depth;
if (depth > 0) {
left = new tree(depth-1);
right = new tree(depth-1);
}
}
public void print(int levels) {
for (int i = 0; i