Apex - Class
A class is a template or blueprint from which objects are created. An
object is an instance of a class. This is standard definition of Class.
→ 3 ways to create apex
class in salesforce
- Apex Class
- Apex from Developer Console
- Force.com Eclipse IDE
From Apex
Class:
Step 1: Click on Setup option. (Top right side on Org)
Step 2: Search 'Apex Class' in Quick find box and click
on Apex Classes link. It will open the Apex Class details page.
Step 3: Click on 'New' button to create new Class.
Step 4: Write code here and then click on save button.
Step 1: Go to Name
and click on Developer Console.
Step 2: Click on
File menu → New and then click on Apex class.
Step 3: Write Class name
and click on OK button.
Step 4: Write code here.
From Force.com IDE:
Step 1: Open Force.com – Eclipse.
Step 2: Create a New project by clicking on File → New → Apex Class.
Step 3: Write the Name of Class and click on Finish
button.
Step 4: Once this is done, the new class will be created.
Syntax:
private | public | global
[virtual | abstract | with sharing | without sharing]
class ClassName [implements InterfaceNameList] [extends ClassName]
{
// Classs Body
}
Example:
public class Sampleclass
{
public static Integer a1 = 0;
public static Integer getmultiValue()
{
a1 = a1 * 10;
return a1;
}
}
Good Article,
ReplyDeleteCan you please add Lightning related article.
Ya, Next article will be Salesforce Lightning.
Delete