Java对象拷贝
public class Person implements Serializable {
private String name;
private int age;
private GregorianCalendar birthday;
public Person(){
}
public Person(String name, int age, GregorianCalendar birthday){
this.name = name;
this.age = age;
this.birthday = birthday;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public GregorianCalendar getBirthday() {
return birthday;
}
public void setBirthday(GregorianCalendar birthday) {
this.birthday = birthday;
}
public static void main(String[] args) {
Person p = new Person("张三",13,new GregorianCalendar(1985,8,1));
Person p2 = null;
try{
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(byteOut);
oos.writeObject(p);
相关文档:
http://hi.baidu.com/shedewang/blog/item/b4a71b254e43ce35c895599b.html
说是支持1亿pv/天,也许有点夸张,但如果您能认真看完相信也不会让您失望。
如果大家真想支持我、支持中国人开源项目,请把该文贴到自己的博客中或者收藏本文,记得包含文档的下载地址!!!!!!!谢谢。
我说的系统主要是构建在hibernate之上 ......
Java代码 < type="application/x-shockwave-flash" width="14" height="15" src="http://xiaoxinshome.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" quality="high" flashvars="clipboard=%20%20%20%20%20 ......
public static void CentreWnd(Shell shell){
int width = shell.getMonitor().getClientArea().width;
int height = shell.getMonitor().getClientArea().height;
int x = shell.getSize().x;
int y = shell.getSize().y;
if (x > width) {
shell.getSize().x = width;
}
if (y > height) ......
1、饿汉式
package singleton;
/**
* 饿汉式单例
* @author 蒋明原
*
*/
public class HungrySingleton {
/**jvm保证instance只被初始化一次*/
private static HungrySingleton instance = new HungrySingleton();
/**阻止外部使用new实例化对象*/
private Hun ......