You need to sign in to do that
Don't have an account?
prasanth puvvada 4
constructor error in custom datatype in list
i am getting this error. Error: Compile Error: Constructor not defined: [student].<Constructor>(String, Integer) at line 9 column 12
public class listex1
{
public list<student> result{set;get;}
public listex1()
{
result=new list<student>();
student s1=new student('sai',22);
student s2=new student('kiran',33);
student s3=new student('hari',34);
result.add(s1);
result.add(s2);
result.add(s3);
}
}
public class listex1
{
public list<student> result{set;get;}
public listex1()
{
result=new list<student>();
student s1=new student('sai',22);
student s2=new student('kiran',33);
student s3=new student('hari',34);
result.add(s1);
result.add(s2);
result.add(s3);
}
}
All Answers
What is this Student ?
if you have apex class Called Student make sure Student class and constructor are public and it has a constructor like
public Student (String name ,integer age)
{
}
Amit Chaudhary 8, sir please explain the above code that u have written as "public class student". Thanks in advance.
Please check below link for for more information :-
https://developer.salesforce.com/page/Wrapper_Class
https://www.minddigital.com/what-is-wrapper-class-and-how-to-use-it-in-salesforce/
http://www.sfdcpoint.com/salesforce/wrapper-class-in-apex/
Please mark this as solution if this will help you.