You need to sign in to do that
Don't have an account?
Mayank Deshpande 22
facing problem in debugging apex.
i write code to search a contact ----- wnat to debug this code in developer consol , but not able to do the same
Public Class ContactSearch{
List <Contact> Con = New List<Contact>();
Public List<Contact> searchForContacts (String A, String B){
Con = [ Select Id , FirstName,LastName from Contact where lastname='A' and MailingPostalCode='B'];
return (Con);}
}
in developer consol i write one apex class and called a method of contact search class but getting error Line: 1, Column: 1
Unexpected token 'Public'.
Public Class NewContactSerach {
ContactSearch Contc = New ContactSearch ();
Contc.searchForContacts(Deshpande.abcde);
}
plz suggest me how to overcome from this
Public Class ContactSearch{
List <Contact> Con = New List<Contact>();
Public List<Contact> searchForContacts (String A, String B){
Con = [ Select Id , FirstName,LastName from Contact where lastname='A' and MailingPostalCode='B'];
return (Con);}
}
in developer consol i write one apex class and called a method of contact search class but getting error Line: 1, Column: 1
Unexpected token 'Public'.
Public Class NewContactSerach {
ContactSearch Contc = New ContactSearch ();
Contc.searchForContacts(Deshpande.abcde);
}
plz suggest me how to overcome from this
All Answers
Thanks for reply!!
still not able to execute the class throug developer consol same error came again .
i declere method in contact serach as static and invoke the method
Public Class NewContactSerach {
ContactSearch.searchForContacts('Deshpande','abcde');
}
why do you want to have a second class to test the first class? why dont you directly run like below?