Free Salesforce Developers Tutorials >

Chapter 3 - Apex Datatypes and Operators >

Integer Datatype in APEX

Integer Datatype in APEX

What You’ll Learn


S2 Labs

Integer datatypes are those whose variables can store negative and positive values.

Types of Integer Datatype

There are 2 integer types that we can use to store values.

  1. Integer (4 bytes) →  Range(-2147483647 to +2147483647)
  2. Long (8 bytes) → Range (-263 to +263-1)

Syntax of Integer Datatype

Integer intValue = 343;

  • If the literal goes out of the integer range then append l or L at the end of the literal because by-default a number is treated as an integer.
    Eg.

Long largeValue = 3434343434L;

  • If the value is not in the range of type defined then the compiles time error is generated.

 

 

salesforce-developer

Download Study Material

Get access to exclusive study material for Salesforce Certification and ace your exams!

Download Now

Our Salesforce Certification Courses

Hey there! Glad you made it through our Salesforce Developer Training for beginners . But wait! We've got some high-in-demand Salesforce courses for you to take your Salesforce skills to the next level, making you a desired professional in the Salesforce job market.

Post a Comment

Your email address will not be published. Required fields are marked *