Long Data Type In Java

Card image cap

Long Data Type ?

Long data is a 64-bit signed two's complement integer.


The minimum value is -9,223,372,036,854,775,808 and maximum value is 9,223,372,036,854,775,807(inclusive)

This type is used when a wider range than int is needed.

Example:
long a= 100000L, int b= 3200000L

Long is a data type used in programming languages, such as Java, C++, and C#. A constant or variable defined as long can store a single 64-bit signed integer.


Card image cap

Example 1:



Output :


 123456789

Example 2:



Output :

byte Value =100
short Value =123
int Value = 123543
int second Value = -9876345
long Value = 1234567891
float Value = 12.25
double Value = 12345.234
boolean Value  = true
boolean Value = false
char Value = X
char Value = Y
Card image cap