用cmd运行没问题,但是用MyEclipse运行就总是报错。总是提示:没有方法错误?什么意思?Exception in thread "main" java.lang.NoSuchMethodError: day14to17.Student.<init>(Ljava/lang/String;Ljava/lang/String;)V
at day14to17.MapDemo3.demo(MapDemo3.java:50)
at day14to17.MapDemo3.main(MapDemo3.java:78)
package day14to17;
/*
map 扩展知识
map集合被使用是应为具备映射关系。
“预热班” Student( “01” “zhangsan”)
"预热班" Student(“02” “lisi”)
"就业办" “01” “wangwu”
"就业办" “02” “heliu”
一个学校有多个教室,每一个教室都有名称。
*/
import java.util.*;
class Student
{
private String id;
private String name;
Student(String id,String name)
{
this.id = id;
this.name = name;
}
public String getId()
{
return id;
}
public String getName()
{
return name;
}
public String toString()
{
return id+"::"+name;
}
}
class MapDemo3
{
public static void demo()
{
//List<Student>,存储学生对象。
HashMap<String,List<Student>> czbk = new HashMap<String,List<Student>>();
List<Student> yure = new ArrayList<Student>();//多态