import java.util.ArrayList;
class MailAddress
{
private String name;
private String street;
private String city;
private String country;
private long pinCode;
ArrayList store1 = new ArrayList();
MailAddress(String name1,String street1,String city1,String country1, long pinCode1)
{
name = name1;
street = street1;
city = city1;
country = country1;
pinCode = pinCode1;
}
public void store(MailAddress obj1,MailAddress obj2,MailAddress obj3)
{
store1.add(obj1);
store1.add(obj2);
store1.add(obj3);
}
public void show()
{
System.out.println("******************************************");
System.out.println("客户电子邮件地址");
System.out.println("*******************************************");
System.out.println();
System.out.println("[");
for(int i=0; i<store1.size(); i++)
{
System.out.println((chapter7p4)(store1.get(i)).name);
System.out.println((chapter7p4)(store1.get(i)).street);
System.out.println((chapter7p4)(store1.get(i)).city);
System.out.println((chapter7p4)(store1.get(i)).country);
System.out.println((chapter7p4)(store1.get(i)).pinCode);
if(store1.size() == i)
{
System.out.println(",");
}
}
System.out.println("]");
}
}
public class chapter7p4
{
public static void main(String args[])
{
MailAddress obj1 = new MailAddress("David Clarke","10 Downing","LondonState : London","United Kingdom",110022);
MailAddress obj2 = new MailAddress("John Lenon","12 Park Avenue","CaliforniaState : California","USA",210033);
MailAddress obj3 = new MailAddress("Stefii Graff","14 Maple Lane","MahomaState : Sydney","Australia",412033);
obj1.store(obj1,obj2,obj3);
obj1.show();
}
}