An easy tutorial for knowing what are data types used in apex and salesforce

Boolean:what are data types used in apex and salesforce

A value that can only be assigned true, false, or null. For example: Boolean ispower = true;

Blob:what are data types used in apex and salesforce

A collection of binary data stored as a single object. You can convert this datatype to String or from String using the toString and valueOf methods, respectively. Blobs can be accepted as Web service arguments.

Date:what are data types used in apex and salesforce

 

A value that indicates a particular day. Unlike Datetime values, Date values contain no information about time. Date values must always be created with a system static method. We cannot manipulate a Date value, such as add days, merely by adding a number to a Date variable. You must use the Date methods instead.

Datetime:what are data types used in apex and salesforce

what are data types used in apex and salesforce A value that indicates a particular day and time, such as a timestamp. Datetime values must always be created with a system static method. We do not manipulate a Datetime value, such as add minutes, merely by adding a number to a Datetime variable. You must use the Datetime methods instead.

Decimal:what are data types used in apex and salesforce

A number that includes a decimal point. Decimal is an arbitrary precision number. Currency fields are automatically assigned the type Decimal. If you do not explicitly set the scale, that is, the number of decimal places, for a Decimal using the setScale method, the scale is determined by the item from which the Decimal is created.

  1. When decimal isw created from a string value, you would measure its scale by measuring the charaters
  2. When decimal is created as from query base search, you would measure its scale by measureing the result of query.
  3. the number to a String and then using the number of characters after the decimal point.

Integer:what are data types used in apex and salesforce

A 64-bit number that does not include a decimal point.

Long:what are data types used in apex and salesforce

Long have a minimum value of -263 and a maximum value of 263-1. Use this datatype when you need a range of values wider than those provided by Integer. For example: Long l = 2147483648L;

String size:what are data types used in apex and salesforce

Strings have no limit on the number of characters. 

Escape Sequences:

All Strings in Apex use the same escape sequences as SOQL strings:  \f (form feed), \r (carriage return), \” (double quote), \b (backspace), \t (tab), \n (line feed), \’ (single quote), and \\ (backslash). Comparison Operators: Apex Strings support use of the comparison operators ==, !=, <, <=, >, and >=. Apex salesforce would trigger an error if we cross the limit of character which are assigned in the specified field.

For more, Click here