import java.util.*; public class Employee implements java.io.Serializable { public String name; public String address; public int AMKA; public transient double salary; public transient Employee next; public transient ArrayList list; public String toString() { String str = "Name: " + name+"\n"; str+="Address: " + address+"\n"; str+="AMKA: " + AMKA+"\n"; str+="Salary: " + salary+"\n"; if(next != null) str+="Next: " + next.name+"\n"; if( list != null) { Iterator it = list.iterator(); if( it.hasNext() ) { str+="List: "; } while( it.hasNext() ) { str+= it.next().name+", "; } str+="\n"; } return str; } }