function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ashutosh MohanAshutosh Mohan 

Method does not exist or incorrect signature: void add() from the type addition

public class addition {
    integer a,b,c;
    public void add(){
        a=2;b=4;
    c=a+b;
        
system.debug('the add is :' +c);
        }
}


addition c = new addition();
c.add();
Satish PrajapatSatish Prajapat
Hello Ashutosh,
Please write below code in Anonymous window than you can able to execute your logic. (Shortcut is CTRL + E)
addition c = new addition();
c.add();

Please choose it best answer if your doubt is clear.
Thanks,
Satish prajapat
Ashutosh MohanAshutosh Mohan
hi satish 
thank you for you reply ,i  m writing the same code in Anonymous window but still i am getting the same error while executing
addition c = new addition();
c.add();
Satish PrajapatSatish Prajapat
hello Ashutosh,
Your code is working in my org.
Please check the image below:
Please check Image.
Thanks.
Satish PrajapatSatish Prajapat
Does the above post helps you, than like it or choose it as best answer.