Apex Variable Declaration – Apex Data Types List

Apex Variable Declaration – Apex Data Types List.

In our last Salesforce Developer Tutorial we have learned about Apex Basics and Apex language building blocks. In this Salesforce Apex Tutorial we are going to learn about apex variables, Apex Variable declaration, Apex Data types.

Apex variables and Variable Declaration.

As already we discussed about Apex language that is a strongly typed language so we have to declare  all variable before they are referenced in Apex coding. As general when we declare variables we have to declare data type followed by variable name.

Example :- Integer i; (Integer = Data Type, i = variable name).

  • We should not declare variable name with symbols, numeric values.
  • Variable names should not contained with underscore(_) extension.
  • We should not use apex reserve words.
  • We can use both lower case and upper case letters since they are not case sensitive.

Apex Data Types list.

Data Type Valid Values
String Zero and Unicode characters
Boolean True / False
Date Date
DateTime Date & Time
Time Time
Integer -2,147,483,648 to 2,147483,647
Long  -263 to 263-1
Decimal signed number
Double  -263 to 263-1
Blob binary data value.
ID 18 characters
Object —–

 

Leave a Reply