| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 709 人关注过本帖
标题:[求助]错在哪啊ArrayList
取消只看楼主 加入收藏
NiceGirl
Rank: 2
等 级:新手上路
威 望:4
帖 子:909
专家分:0
注 册:2006-6-18
收藏
 问题点数:0 回复次数:1 
[求助]错在哪啊ArrayList

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();
}
}

搜索更多相关主题的帖子: ArrayList String private city name 
2006-07-01 15:36
NiceGirl
Rank: 2
等 级:新手上路
威 望:4
帖 子:909
专家分:0
注 册:2006-6-18
收藏
得分:0 
是类型转换错误,谢谢水影~!

曾经以为百般艰难,蓦然回首,才发现已飞渡千山。。!
2006-07-02 13:53
快速回复:[求助]错在哪啊ArrayList
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.029663 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved