【发布时间】:2014-06-06 01:28:03
【问题描述】:
有人可以帮我解释一下ma.add(new HighRights("AAA")); 的作用吗?
主要来自班级:
public static void main(String [] a){
ArrayList<SecurityRights> ma=new ArrayList<SecurityRights>();
ma.add(new HighRights("AAA"));
}
HighRights 类:
public class HighRights extends SecurityRights
{
private String name;
public HighRights(String n){
super(true);
this.name = n;
}
public String getName(){
return name;
}
public static void main(String[] a){
HighRights s= new HighRights("Lisa");
System.out.print(s.getName() +" "+s.getSecret());
}
}
【问题讨论】:
-
请澄清您到底不明白什么。你能指出文档的哪一部分不清楚吗?
-
这几乎是不言自明的......
-
docs.oracle.com/javase/7/docs/api/java/util/… ...它..添加到列表中。