📄 example8_11.java
字号:
import java.io.*;
import java.util.*;
class Address implements Serializable
{
protected String first, email;
public Address( )
{
first = email = "";
}
public Address( String _first, String _email )
{
first = _first;
email = _email;
}
public String toString( )
{
return first + " (" + email + ")" ;
}
}
//主类
public class Example8_11
{
public static void main( String args[ ] )
{
try{
FileOutputStream file = new FileOutputStream("test.dat");
ObjectOutputStream out = new ObjectOutputStream(file);
Date now = new Date();
Address address = new Address("abc", "abc@zsm8.com");
out.writeObject(now);
out.writeObject(address);
out.close();
System.out.println("ok");
}
catch(IOException ioe)
{ System.out.println(ioe); }
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -