public static void print(ArrayList<? extends Person> al)
{
for (Iterator<? extends Person> it = al.iterator();it.hasNext() ; )
{
System.out.println(it.next().getName());
}
}
}
}
class Person
{
private String name ;
Person(String name )
{
this.name = name ;
}
public String getName()
{
return name ;
}
}
class Student extends Person
{
Student(String name )
{
super(name) ;
}
} 作者: 短板 时间: 2015-5-7 16:29
cmd运行 一直说19行错误 public static void print(ArrayList<? extends Person> al)