一个对象序列化的有关问题,请大家帮忙指点

一个对象序列化的问题,请大家帮忙指点
最近看JAVA对象序列化时碰到的一个问题

//第一个类
import   java.io.*;
class   logon   implements   Serizaliable
{
    private   String   username;
    private   transient   String   password;
    Logon(String   name,String   pwd)
{
username=name;
password=pwd;
}
public   String   toString()
{
String   pwd=(password==null)?   "(null)   "   :   password;
return   "logon   info: "+ "\n[username:] "+username+ "\n[password:] "+pwd;
}
}
//第二个类
import   java.io.*;
public   class   SendLogon
{
public   static   void   main(String   []args)
throws   IOException,ClassNotFoundException
{
Logon   a=new   Logon( "David ", "123456 ");
System.out.pringln(a);

ObjectOutputStream   o=new   ObjectOutputStream(new   FileOutputStream( "Logon.out "));
System.out.println( "Sending   object   of   Logon... ");
o.writeObject(a);
o.close();
}
}
//第三个类
import   java.io.*;
public   class   AcceptLogon
{
public   static   void   main(String   []args)
throws   IOException,ClassNotFoundException
{
ObjectInputStream   o=new   ObjectInputStream(new   FileInputStream( "Logon.out "));
System.out.println( "Accepting   object   of   Logon... ");
Logon   b=(Logon)in.readObject();
System.out.println(b);
}
}
这三个类在最后打印时会打印出这样一条语句

Logon   info   :
[username:]   David
[password:]   123456
Sending   object   of   Logon...

请问这个函数在什么时候被调用了,怎么会打印出来的  




------解决方案--------------------
楼主什么意思?
是不明白System.out.pringln(a);这条语句为什么会打印出
Logon info :
[username:] David
[password:] 123456
这些信息吗?
打印时自动调用了对象a的toString()方法。