Search Here

Apex long data type

In Apex, the Long data type is used to represent large integer values. It is a 64-bit signed integer type, allowing you to work with very large whole numbers.

public class LongExample {

    public static void main() {

        Long largeNumber = 9223372036854775807; // Maximum positive value

        Long negativeNumber = -9223372036854775808; // Minimum negative value

        

        System.debug('Large Number: ' + largeNumber);

        System.debug('Negative Number: ' + negativeNumber);

    }

}

In this example, we declare a Long variable largeNumber and assign it the maximum positive value that can be represented by a Long data type. We also declare a Long variable negativeNumber and assign it the minimum negative value. Apex allows you to work with these large integer values using the Long data type.


 


Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.