Activity Forums Salesforce® Discussions Explain Considerations for Static keyword in Salesforce Apex.

  • shariq

    Member
    September 22, 2018 at 6:28 pm

    Apex classes cannot be static.
    Static allowed only in outer class.
    Static variables not transferred as a part of View State.
    Static variables and static block runs in order in which they are written in class.
    Static variables are static only in scope of request.

  • Parul

    Member
    September 23, 2018 at 6:04 am

    static: This keyword defines a method/variable that is only initialized once, and is associated with an (outer) class, and initialization code. We can call static variables/methods by class name directly. No need of creating instance of a class.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos