You need to sign in to do that
Don't have an account?
Divya Yadav
Create a method for inserting accounts.
Hi
I tried this
public class AccountHandler {
public static Account insertNewAccount(String name) {
Account a = new Account();
a.Name = name;
try
{
insert a;
} catch (Exception e) {
return null;
}
return a;
}
}
but it is giving error "Line: 2, Column: 23
Only top-level class methods can be declared static"
I tried this
public class AccountHandler {
public static Account insertNewAccount(String name) {
Account a = new Account();
a.Name = name;
try
{
insert a;
} catch (Exception e) {
return null;
}
return a;
}
}
but it is giving error "Line: 2, Column: 23
Only top-level class methods can be declared static"
The entire file should look like
I suspect you have this