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, 这个是我在另一个包里定义的类, 这个不用关心, 问题是为什么定义这样的一个方法会报错?
求解答

解决方案 »

  1.   

    getEmps 作为一个方法,它的()不见了,这是很严重的问题
      

  2.   

     public List<Employee> getEmps { ???
    这样定义了方法?
    带着()。
      

  3.   

    public List<Employee> getEmps() { // Syntax error, insert ";" to complete FieldDeclaration
            return emps;            // Void methods cannot return a value
        }
      

  4.   


    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
        }
    }
      

  5.   

    public class OgnlAction {
            private List<Employee> emps;
        public List<Employee> getEmps() { // Syntax error, insert ";" to complete FieldDeclaration
            return emps;            // Void methods cannot return a value
        }
    }