1
public class ListEx {
    public static void mymethod()
    {
        list<integer> myList= new List<integer>();
        myList.add(10);
        myList.add(30);
        myList.add(40);

        integer lsize= myList.Size();
            system.debug('List Size'+lsize);

        system.debug('List'+myList);


    }
}

Declaring Method in APEX:

ListEx.mymethod();

Whenever i try to run a program It is throwing an error saying

"Method does not exist or incorrect signature: void mymethod() from the type ListEx "`

enter image description here enter image description here

4
  • 1
    this script runs properly Aug 9 '17 at 19:23
  • Can you edit this question to include a test class others can use to help you debug this issue? Aug 9 '17 at 19:39
  • Is your ListEx class actually saved? I only ask because the * is still showing in the Developer console, which implies it hasn't been saved yet. Aug 9 '17 at 22:40
  • @jamesandy Is your issue now resolved? Aug 10 '17 at 0:00
2

From the comment thread is seems like the issue was related to the Apex class not yet being saved in the Developer Console.

The * that is appearing in the file name in the dev console indicates that the file hasn't been saved since it was last modified. In your case it appears that it has never been saved.

You will need to save the Apex class before it become accessible to anonymous apex.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.