You need to sign in to do that
Don't have an account?
Puja khetan
i am trying to write my first apex class
trying to write apex class .
when i am creating it as new apex class ,it is throwing so many error like from is invalid
like is invalid
same code when i am running on anonumous window ,it is running fine
public class tes
{
List<Account> acc = new List<Account>();
acc = [SELECT id, Name from Account where Name like '%Test%' ];
for (Account acc1 : acc)
system.debug(acc1.name);
}
some one please help
when i am creating it as new apex class ,it is throwing so many error like from is invalid
like is invalid
same code when i am running on anonumous window ,it is running fine
public class tes
{
List<Account> acc = new List<Account>();
acc = [SELECT id, Name from Account where Name like '%Test%' ];
for (Account acc1 : acc)
system.debug(acc1.name);
}
some one please help
You have written the correct query.Try to update your class like below
Regards
Vijay