题目是要我用ArrayList来存储 客户的信息;然后显示ArrayList中的类容
这是我的代码
import java.util.ArrayList;
class bean{
String name;
String Street;
String City;
String Country;
String PinCode;
public String getname() {
return name;
}
public void setname(String name) {
this.name = name;
}
public String getStreet() {
return Street;
}
public void setStreet(String Street) {
this.Street = Street;
}
public String getCity() {
return City;
}
public void setCity(String City) {
this.City = City;
}
public String getCountry() {
return Country;
}
public void setCountry(String Country) {
this.Country = Country;
}
public String getPinCode() {
return PinCode;
}
public void setPinCode(String PinCode) {
this.PinCode = PinCode;
}
}
class test{
public static void main(String []args){
bean a=new bean();
a.setname("A");
a.setStreet("A1");
a.setCity("A2");
a.setCountry("A3");
a.setPinCode("A4");
ArrayList list=new ArrayList();
list.add(a);
}
}
我把bean类的实例a添加到ArrayList的实例list以后,怎么用list把实例a的这些什么A,A1这些信息输出啊 ,我书上就写了个怎么把添加的String类输出,没有写自定义类的,那位大哥来帮帮忙 谢谢拉.
[此贴子已经被作者于2006-10-16 19:26:05编辑过]