You need to sign in to do that
Don't have an account?
Initial term of field expression must be a concrete SObject: LIST<College.StudentClass>
public class College
{
// college name.
Public Static final String CollegeName ='Tirumala Engg College';
// college address.
public Static final String CollegeAdress='kesaraGutta,Bogaram,Hyderabad.';
//college Year of Establishment.
public Static final Integer DOE=1990;
// creating Student class
public class StudentClass
{
// creating properties for the required Student feilds(student number,student name,student address etc).
public Integer sNo{get;set;}
public String sName{get;set;}
public String sAddress{get;set;}
public Integer doj{get;set;}
public String course{get;set;}
}
public class InstructorClass
{
// creating properties for Instructor feilds.
public Integer iNo{get;set;}
public String iName{get;set;}
public String iQualification{get;set;}
public Integer iDeptno{get;set;}
}
public class DeptClass
{
//creating properties for Department feilds.
public Integer deptNo{get;set;}
public String deptName{get;set;}
public String deptLoc{get;set;}
}
//creating a list of students
public List<StudentClass> students =new List<StudentClass>();
////creating a list of Instructors
public List<InstructorClass> instructors =new List<InstructorClass>();
//creating a list of Departments
public List<DeptClass> departments =new List<DeptClass>();
/* public String College()
{
return 'Welcome to '+ College.CollegeName;
}*/
public static StudentClass searchStudent(Integer stNo,List<StudentClass> Stds)
{
for(College.StudentClass student:stds)
{
if(Stds.sNo==stNo)
{
return student;
}
}
}
}
hi can tell what's the error , am unable to understand error. any suggestion
The List which you're using are not of concret SObject, You will have the follwing changes:
Add the __c to the custom Object name
List<StudentClass__c> students =new List<StudentClass__c>();
Please follow the same to the other Lists as well
Hope this helps!!
Regards
Sam
All Answers
I think
if(Stds.sNo==stNo)
should be
if(student.sNo==stNo)
The List which you're using are not of concret SObject, You will have the follwing changes:
Add the __c to the custom Object name
List<StudentClass__c> students =new List<StudentClass__c>();
Please follow the same to the other Lists as well
Hope this helps!!
Regards
Sam
By making this change, the error should be resolved, and the searchStudent method should function correctly.