long Datatype in Java
Java Programming Language DataTypes in java (Article) DataTypes in java (Program)
2169
- Long data type is a 64-bit signed two's complement integer
- Minimum value is -9,223,372,036,854,775,808(-2^63)
- Maximum value is 9,223,372,036,854,775,807 (inclusive)(2^63 -1)
- This type is used when a wider range than int is needed
- Default value is 0L
- Example: long a = 100000L, long b = -200000L
Program:
public class LongDataType { public static void main(String []args) { // this is declaration and initialization of variable a // datatype is long long a = 100000L; // this is declaration and initialization of variable b // datatype is long long b = -200000L; System.out.println(a); // it will print a variable System.out.println(b); // it will print b variable } }
Output:
100000 -200000 Press any key to continue . . .
This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.