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
sony sonusony sonu 

salesforce basics, executing in anonymous window

public class restapijava{
 
     public void add(){
      integer x = 10;
       integer y =20;
        integer z = x+y;
        system.debug(z);
    }
    
    
    public static void main(string[] args){
    
        restapijava referncer = new restapijava();
             referncer.add();  
    }
 }
 how can i call it in the anonymous window..??
 
Best Answer chosen by sony sonu
Raj VakatiRaj Vakati
Create an apex class with blow code 


public class restapijava{
 
     public void add(){
      integer x = 10;
       integer y =20;
        integer z = x+y;
        system.debug(z);
    }
    
   
 }


Go to execute anonymous  window and run the below code

restapijava referncer = new restapijava();
referncer.add(); 

 

All Answers

Raj VakatiRaj Vakati
Create an apex class with blow code 


public class restapijava{
 
     public void add(){
      integer x = 10;
       integer y =20;
        integer z = x+y;
        system.debug(z);
    }
    
   
 }


Go to execute anonymous  window and run the below code

restapijava referncer = new restapijava();
referncer.add(); 

 
This was selected as the best answer
sony sonusony sonu
thanks....