Exception in thread "main" java.lang.NoSuchMethodError求解决办法
import java.util.*;class Person
{
private String name;
Person(String name)
{
this.name = name;
}
String GetName()
{
return name;
}
}
public class Text_11 {
public static void main(String []args)
{
ArrayList<Person> p = new ArrayList<Person>();
p.add(new Person("abc1"));
p.add(new Person("abc2"));
p.add(new Person("abc3"));
printColl(p);
}
public static void printColl(ArrayList<Person> p)
{
Iterator it = p.iterator();
while(it.hasNext())
{
System.out.println(it.next().toString());
}
}
}
Exception in thread "main" java.lang.NoSuchMethodError: Person.<init>(Ljava/lang/String;)V
at Text_11.main(Text_11.java:20)