import java.util.ArrayList;public class Base {  private String property1;
  private String property2;
public String getProperty1() {
return property1;
}
public void setProperty1(String property1) {
this.property1 = property1;
}
public String getProperty2() {
return property2;
}
public void setProperty2(String property2) {
this.property2 = property2;
}
public static ArrayList getBaseList() {
ArrayList list = new ArrayList();
Base base = new Base();
list.add(base);
return list;
}}

解决方案 »

  1.   

    没什么问题 但是如果Base作为一个javabean 的话 那个getBaseList方法就应该写在另一个类中
      

  2.   

    用setXXX()和getXXX()就可以把属性都定义为private的
    可以提高安全性
      

  3.   

    谢谢诸位了,实际上smyl9989(真我的风采)是理解我的意思了,但没有回答为什么要把getBaseList方法写到另一个类中,放在一个类中有什么问题,我是想知道这个