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
siliveru venkateshsiliveru venkatesh 

Error: Method does not exist or incorrect signature: void ifex1() from the type ifex1

Hi All I am facing This Error any one can help me.
Akhil TandonAkhil Tandon
Please share the piece of code which is causing this error.
siliveru venkateshsiliveru venkatesh

public class ifex1 
{
  public integer num1,num2,result;
    public ifex1()
    {   
    num1 =10;
    num2 =20;
    result =num1 +num2;
    system.debug('Addition :'+result);
    result =num1 -num2;
    system.debug('subtraction :'+result);    
    result =num1 *num2;
    system.debug('Multiplication :'+result);
    if( num2>0  ) 
    {   
    result =num1 /num2;
    system.debug('Division :'+result);
    }   
    }
    
}
Aman MalikAman Malik
Hi siliveru,
It seems you are calling constructor like method.
public ifex1()
is a constructor, not method.
So, stop calling it, it automatically initializes.

Thanks,
Aman
 
siliveru venkateshsiliveru venkatesh
Hi.... Aman Malik
Thanks 
Aman MalikAman Malik
Hi siliveru,
Please mark the answer as best if that helps. 

Thanks
Aman
Aman MalikAman Malik
Hi siliveru,
It seems, by mistake you mark your answer as best instead of mine.
Kindly correct it.

Thanks,
Aman