Salesforce Apex Tutorial Chapter 14: Apex Objects

Salesforce Apex Tutorial Chapter 14: Apex Objects

On November 9, 2021, Posted by , In Salesforce Apex Tutorial, With Comments Off on Salesforce Apex Tutorial Chapter 14: Apex Objects
Apex Objects
Apex Objects

An object is an instance of a class. The object can be a class object in Salesforce, or it can also be an object of sObject.

Object creation In Apex: An object of the class can be created in the same way as created in Java or another object-oriented programming language.

Example:

public class DemoClass{
String salutation= ‘Mr.’;
public void methodName (String firstName) {
String fullName;
fullName= firstName +’:’+ salutation;
System.debug(fullName is '+fullName);
}}
DemoClass obj = new DemoClass(); // instance of above class
obj.methodName (‘Andrew’); // access method from above class 
Comments are closed.