import java.util.List;
import mypg.model.Employee;public class OgnlAction {
private List<Employee> emps=new ArrayList<Employee>();
public List<Employee> getEmps { // Syntax error, insert ";" to complete FieldDeclaration
return emps; // Void methods cannot return a value
}
}
不知道为什么会报错, 非要说是: Syntax error, insert ";" to complete FieldDeclaration
至于 Employee, 这个是我在另一个包里定义的类, 这个不用关心, 问题是为什么定义这样的一个方法会报错?
求解答
这样定义了方法?
带着()。
return emps; // Void methods cannot return a value
}
import java.util.List;
import mypg.model.Employee;public class OgnlAction {
private List<Employee> emps=new ArrayList<Employee>();
public List<Employee> getEmps() { // Syntax error, insert ";" to complete FieldDeclaration
return emps; // Void methods cannot return a value
}
}
private List<Employee> emps;
public List<Employee> getEmps() { // Syntax error, insert ";" to complete FieldDeclaration
return emps; // Void methods cannot return a value
}
}