class Teacher1 { public Teacher1() { }}class Teacher2 { public void Teacher2(String name) { }}public class TeacherTest { public static void main(String[] args) { Teacher1 t1 = new Teacher1(); Teacher2 t2 = new Teacher2("Mr lee"); }}
The constructor Teacher2(String) is undefined
把 上面的 void 去掉就好了