0

I've slung alot of code in multiple languages but am new to Salesforce and Apex. I see Apex is very much like Java. I see where one can execute @IsTest methods within a @IsTest Apex class. But how does one execute non-test code directly? Or must one always build and fire off a Job? Or do you write Java in VSC with the Salesforce CLI and Apex plugins? Any equivalent "Hello World" examples?

TIA,

Still-learning Steve

Giliam
  • 608
  • 3
  • 15
code_warrior
  • 77
  • 10

1 Answers1

1

sharing a very basic example here

public class Stack {

    public static void printDetails(){
        system.debug('in static method');
    }

    public void printDetails1(){
        system.debug('in non static method');
    }

}

in order to trigger the above class you have created you can use the developer console Developer Console -> Debug -> Open Execute Anonymous Window and pase the below lines and click on execute

Stack.printDetails();
Stack s= new Stack();
s.printDetails1();

https://help.salesforce.com/articleView?id=code_dev_console.htm&type=5